Skip to content

Commit

Permalink
Quote URLs before curls, only if not already quoted
Browse files Browse the repository at this point in the history
  • Loading branch information
homebysix committed Oct 15, 2023
1 parent 41c5fbd commit 0e9f91d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ All notable changes to this project will be documented in this file. This projec
- Prevented app window from expanding too much horizontally when processing extremely long filename or URL inputs.
- Fixed incorrect `[0m` that terminated script output in app.
- Fixed MacUpdate description pattern matching.
- Better handling of apps (and their associated URLs) with spaces, ampersands, and other special characters.

### Changed

Expand Down
6 changes: 6 additions & 0 deletions scripts/recipe_robot_lib/curler.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

import os.path
import subprocess
from urllib.parse import quote, unquote

from .exceptions import RoboError
from .tools import KNOWN_403_ON_HEAD, LogLevel, robo_print
Expand Down Expand Up @@ -264,6 +265,11 @@ def download_to_file(url, filename, headers=None, app_mode=False):
"""
curl_cmd = prepare_curl_cmd()
add_curl_headers(curl_cmd, headers)

# Quote URL if not already quoted. Curl will fail if path is unquoted, in some cases.
# https://github.com/homebysix/recipe-robot/issues/197
url = quote(url, safe=":/") if url == unquote(url) else url

# Disable silent mode in order to display download progress bar.
if not app_mode:
curl_cmd.remove("--silent")
Expand Down

0 comments on commit 0e9f91d

Please sign in to comment.