Conversation
`params` in the `OC.generateUrl` function call only replaces all specified occurences of a key just like the l10n PHP functionality does. This means that to build a query string we have to use `OC.buildQueryString` instead of the params parameters. Fixes #16336 which is a regression introduced with 58a87d0 of #15652. Without this fix downloading single files from a public shared folder is not possible.
|
I will think how to add unit tests meanwhile. |
|
Refer to this link for build results (access rights to CI server needed): |
|
👍 |
|
Am preparing unit tests, there is currently no test file for that section. |
|
@LukasReschke I added JS unit tests, please check them out 😄 |
|
A new inspection was created. |
|
I think it's the wrong approach, you don't fix the exception, you fix the method. This does not work properly: Line 135 in 7526886 |
|
@oparoz I think it is a confusion about how to use this. I was also confused the first time with generateUrl... The substitution is done on "{xxx}" strings inside the URL, not appended. |
|
Ah, now I remember, thanks @PVince81 In this case, it might be cleaner to use something like this: and at some point introduce another method which is smarter and adds the params to the URL. |
|
Feel free to make the change, I'm pretty sure @LukasReschke won't mind. 😉 If you do, please also make the token a parameter: |
|
Refer to this link for build results (access rights to CI server needed): |
|
I tested as is and the proper URL was generated, but I don't mind it staying as is. It will probably be changed in a future PR. But I think this call will fail as well: I changed it at the same time |
|
Hmm right. It is likely that "linkTo" isn't used anywhere so nobody found the issue until now. |
|
It's very possible. A quick search didn't reveal any use of that method. Only calls to OC.linkTo |
Absolutely. Generally speaking hijacking my PRs with good intentions and not too questionable (as in could cause discussions) is always appreciated from my site. Just don't squash it then please ;) |
There was a problem hiding this comment.
I know it can be painful to "bootstrap" a test file when there is none.
But now that it's there, no more excuses for not adding more tests for the public page 😉
|
If you select multiple files (not all of them). the download still generates a zip of the whole share. |
|
mmm apparently my cache was not completely flushed... it does work. 👍 |
Fix URL generation

paramsin theOC.generateUrlfunction call only replaces all specified occurences of a key just like the l10n PHP functionality does.This means that to build a query string we have to use
OC.buildQueryStringinstead of the params parameters.Fixes #16336 which is a regression introduced with 58a87d0 of #15652.
Without this fix downloading single files from a public shared folder is not possible.
# Testplan 1. Share a folder on master publicly 2. Access the public link and downloading single files does download the whole folder as a ZIP 3. Apply the patch, clear your cache, downloading single files and all works again