Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WinGUP causes download failure by using plugin download URL to generate file name to store downloaded file #9

Open
dinkumoil opened this issue Dec 2, 2018 · 3 comments
Assignees

Comments

@dinkumoil
Copy link

dinkumoil commented Dec 2, 2018

Description

According to this list the plugin Kstudio.MaxscriptExplorer has a download issues with WinGup v5.0.4.

I have debugged this issue and found that WinGup uses the file name part of the plugin download URL to generate the file name used to store the downloaded file. Additionally, if the file name doesn't end with .zip this string gets appended.

In case of Kstudio.MaxscriptExplorer this leads to an illegal file name since the download URL of this plugin is https://3d-kstudio.com/download-manager.php?id=112, thus the resulting file name gets set to %TEMP%\download-manager.php?id=112.zip.

The contained question mark is an illegal character for filesystem objects, thus the download fails because the file can not be stored.

Possible solutions

WinGup should test the generated file name for illegal characters and remove them.

@dinkumoil dinkumoil changed the title WinGUP causes download failure by using plugin download URL to generate directory name to store downloaded file WinGUP causes download failure by using plugin download URL to generate file name to store downloaded file Dec 2, 2018
@dinkumoil
Copy link
Author

dinkumoil commented Dec 19, 2018

In the meanwhile I found another plugin that can not be downloaded due to this issue, the Poor Man's T-Sql Formatter plugin.

Its download link is

http://www.architectshack.com/GetFile.aspx?File=SqlFormatterNppPlugin.1.6.10.zip&Page=PoorMansTSqlFormatter

Again, there is a question mark that causes the download to fail because the local destination file can not be created.

@TaoK
Copy link

TaoK commented Jan 14, 2019

Hi - Poor Man's T-Sql Formatter dev here - without understanding the mechanism of the failure, I posted a thread on this in the community forums: https://notepad-plus-plus.org/community/topic/16940/gup-exe-crashes-on-some-zip-files-and-http-hosts. @dinkumoil helpfully pointed me here.

It's worth noting that I've added a new official download location for the Poor Man's T-Sql Formatter plugin, in a GitHub release (https://github.com/TaoK/PoorMansTSqlFormatter/releases/tag/1.6.10), so this is no longer a blocker for this particular plugin.

It can still easily be a significant cause of frustration for other plugin devs who spend a bunch of time debugging why their plugin won't install. Unfortunately, GUP.exe's UI-less crash here is particularly unhelpful.

@vor0nwe
Copy link

vor0nwe commented Apr 27, 2019

I just ran into the same problem with the PreviewHTML plugin, because I need query string parameters on the download URL. The Appveyor PR commit check doesn't complain, because it’s a perfectly valid URL.

Is there any reason to actually use the URL as basis for the downloaded file? Since it's going to be unzipped anyway, I would expect that a random temporary file name would work just as well (if not better). Alternatively, if the URL-as-basis-for-the-filename is wanted, I suggest chopping off the part after the question mark, at the very least. And always check the resulting file name for invalid characters.

Also, reporting the failure somewhere would be nice, too.

@donho donho self-assigned this Aug 6, 2019
@notepad-plus-plus notepad-plus-plus deleted a comment Mar 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants