WordPress Download Monitor Plugin › Forums › Download Monitor Plugin Forum › Spaces in download filename?
- This topic has 5 replies, 3 voices, and was last updated 4 years, 1 month ago by admin.
-
AuthorPosts
-
October 26, 2018 at 4:18 am #821Hmorris48Participant
when using the “URL” to enter the download file location, the download plugin removes the spaces in the filename.
Note that I can’t use the media library to unload the files as .exe and .dmg file name aren’t allowed by the media library…
October 27, 2018 at 12:55 am #822adminKeymasterA space character is not a valid character for a URL. So rename your file and replace the space character with something like a dash (-) or an underscore (_).
October 6, 2020 at 7:36 pm #1681Geocosm_2000ParticipantSorry to dredge up an old issue however I’m experiencing this exact problem…
I humbly somewhat disagree with your response/position however.
I DO agree that spaces are invalid in a URL. In fact your own code replaces spaces in a filename with the correct %20 sequence (so “my file.zip” becomes “my%20file.zip”) – no problem so far.
My issue is that if I enter “my%20file.zip” manually, then the plugin seems to strip it out completely! The result becomes “myfile.zip” – yikes!
This is even more problematic because as I mentioned before when I enter “my file.zip” the plugin is smart enough to change it to “my%20file.zip” automagically when I click Update.
However, if I re-edit the download (e.g. change a typo in the description field) then click Update again then the %20 is once again stripped and I end up with “myfile.zip”.
THIS is unexpected behaviour and has been a source of unexpected (and difficult to find) problems.
A simple solution here would be to accept the %20 sequence as part of the filename since it is indeed valid in a URL.
Thanks!
October 7, 2020 at 12:30 am #1683adminKeymasterIt’s due to how PHP streaming works. The secure download requires handling of download via PHP streaming (not the standard browser download that you normally use). So if you want the secure PHP streaming downloads, the file names need to be corrected.
WP Media library won’t allow uploading of certain file types for security reasons. The following addon can be used to override that limitation so more file types can be uploaded via the media library’s upload feature:
October 7, 2020 at 3:28 pm #1684Geocosm_2000ParticipantRespectfully I’m not talking about how PHP streaming works I’m talking about an inconsistent UI issue… either you CAN include %20 characters or you cannot… Your code “converts” spaces to %20 (no problem) but you should therefore also accept them if I type them manually (and convert on the back-end if necessary) OR you should strip and replace them in the UI (so it get’s converted every time).
What you have now however is an inconsistent case of YOU can do it but I cannot and furthermore what you return from the back-end and populate into the text box is not valid and hence breaks my downloads.
October 7, 2020 at 11:57 pm #1685adminKeymasterThe plugin doesn’t really convert it the way you are thinking. It calls various sanitation functions of WordPress (for security) which converts the space characters.
-
AuthorPosts
- You must be logged in to reply to this topic.