You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Make sure that the Disallowed Characters (to strip out of title/filename — in addition to /, ?, <, >, , :, *, |, ") option has no extra character, or at least a period (.) is not included to the option
Steps to reproduce:
Open a page where title contains a period (.) in its title (say, any .NET-related page)
Activate the markdown download button/shortcut thus all downloadable images must follow the pattern: <IMG_DIR_FOO>.<IMG_DIR_BAR>/<FILENAME>
Actual results in Firefox:
No images are downloaded
Nothing in logs
Actual results in Chrome:
All images downloaded obeying the <IMG_DIR_FOO>.<IMG_DIR_BAR>/<FILENAME> pattern
Current workaround:
Add period (.) to the Disallowed characters list.
I drilled down to the browser.downloads.download at https://github.com/deathau/markdownload/blob/3.3.0/src/background/background.js#L460 before I figured it out and, as it is seen in the code, the download function is missing the catch. Adding the catch method to the promise returned with browser.downloads.download will produce the following error in the console:
Error: filename must not contain illegal characters
Have no idea why Firefox considers a period in the middle of the file path as an illegal character, and why it does not replace it with dummy character like _ (breaking the downloaded markdown file image references though). This issue seems to be even a "more edge case" than a case with filenames starting with a dot as described here. Interestingly, saving a page (Ctrl+S) with a period in the title works perfectly.
Seems to need to get fixed in the upstream Firefox, and no a special fix in the extension should be provided. I guess the issue might remain open unless Firefox is fixed.
The text was updated successfully, but these errors were encountered:
If the page title contains a slash /, I guess Firefox may attempt to protect from file system path traversal.
If the page title contains a period ., I guess Firefox may consider trailing slashes as a part of file extension which is considered illegal.
I'm not sure how generateValidFileName is supposed to work, but it seems it handles neither slash nor period properly. These two characters may need sanitizing for both path and filename but under different circumstances. Not sure how many path slashes are allowed in Firefox, and not sure if period is only allowed after the last slash.
Prerequisites:
.
) is not included to the optionSteps to reproduce:
.
) in its title (say, any .NET-related page)<IMG_DIR_FOO>.<IMG_DIR_BAR>/<FILENAME>
Actual results in Firefox:
Actual results in Chrome:
<IMG_DIR_FOO>.<IMG_DIR_BAR>/<FILENAME>
patternCurrent workaround:
.
) to the Disallowed characters list.I drilled down to the
browser.downloads.download
at https://github.com/deathau/markdownload/blob/3.3.0/src/background/background.js#L460 before I figured it out and, as it is seen in the code, the download function is missing thecatch
. Adding thecatch
method to the promise returned withbrowser.downloads.download
will produce the following error in the console:Have no idea why Firefox considers a period in the middle of the file path as an illegal character, and why it does not replace it with dummy character like
_
(breaking the downloaded markdown file image references though). This issue seems to be even a "more edge case" than a case with filenames starting with a dot as described here. Interestingly, saving a page (Ctrl+S) with a period in the title works perfectly.If I understand the Firefox correctly, the cause of the error might be caused with this check: https://searchfox.org/mozilla-central/rev/3d20a41f8c74116d79b863148741665e6f9567c1/toolkit/components/extensions/parent/ext-downloads.js#704 (whose error seems to be kind of misleading because the check seems to validate paths only, but reports an illegal filename) that indirectly relies on the sanitize method at https://searchfox.org/mozilla-central/rev/3d20a41f8c74116d79b863148741665e6f9567c1/uriloader/exthandler/nsExternalHelperAppService.cpp#3527 . Speaking frankly, no idea though if I'm on the right way.
Seems to need to get fixed in the upstream Firefox, and no a special fix in the extension should be provided. I guess the issue might remain open unless Firefox is fixed.
The text was updated successfully, but these errors were encountered: