Closed
Bug 697765
Opened 13 years ago
Closed 13 years ago
Mozharness' download_file() method uses os.path.basename on urls
Categories
(Release Engineering :: Applications: MozharnessCore, defect)
Release Engineering
Applications: MozharnessCore
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: ahal, Assigned: ahal)
Details
(Whiteboard: [mozharness])
Attachments
(1 file)
1.53 KB,
patch
|
mozilla
:
review+
mozilla
:
checked-in+
|
Details | Diff | Splinter Review |
http://mxr.mozilla.org/build/source/mozharness/mozharness/base/script.py#145
1) This could lead to invalid file names if the url has parameters or anchors in it (e.g ? is reserved in windows).
2) I don't have a Windows environment handy, but I'm pretty sure this will just return the whole url on Windows.
Instead use something similar to:
import urlparse
parsed = urlparse.urlsplit(url)
if parsed.path != '':
file_name = parsed.path.rstrip('/').rsplit('/',1)[1]
else:
# handle no path
file_name = "default"
Assignee | ||
Updated•13 years ago
|
OS: Linux → All
Hardware: x86 → All
Whiteboard: [mozharness]
Comment 1•13 years ago
|
||
wfm. do you want to write a patch or should i?
Assignee | ||
Comment 2•13 years ago
|
||
I can do it, probably get around to it tomorrow.
Assignee | ||
Comment 3•13 years ago
|
||
Comment 4•13 years ago
|
||
Comment on attachment 570286 [details] [diff] [review]
Patch 1.0 - Use urlparse instead of os.path.basename
We found that the logic here doesn't work perfectly if:
a) you are downloading from http://site.domain/ your file_name will be ''
b) we may have issues if you're downloading from http://site.domain:portnum on windows
Since we allow for specifying file_name when calling download_file(), and I doubt we'll ever really be downloading from the root of a domain on a regular basis, I'm going to r+ and land anyway.
Attachment #570286 -
Flags: review?(aki) → review+
Comment 5•13 years ago
|
||
Comment on attachment 570286 [details] [diff] [review]
Patch 1.0 - Use urlparse instead of os.path.basename
http://hg.mozilla.org/build/mozharness/rev/ae752c6819bd
Attachment #570286 -
Flags: checked-in+
Updated•13 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Updated•12 years ago
|
Product: mozilla.org → Release Engineering
Updated•11 years ago
|
Component: Other → Mozharness
You need to log in
before you can comment on or make changes to this bug.
Description
•