[pve-devel] [PATCH http-server] upload: allow whitespaces in filenames

Thomas Lamprecht t.lamprecht at proxmox.com
Fri Nov 4 14:17:30 CET 2022


Am 04/11/2022 um 11:56 schrieb Dominik Csapak:
> some fields (e.g. filename) can contain spaces, but our 'trim' function,
> would only return the value until the first whitespace character instead
> of removing leading/trailing white space. this lead to giving the wrong
> filename to the api call (e.g. 'foo' instead of 'foo (1).iso') which
> would reject it because of the 'wrong' extension
> 
> this patch fixes that by using a more robust regex replacement
> 
> fixes commit:
> 0fbcbc2 ("fix #3990: multipart upload: rework to fix uploading small files")
> 
> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
> ---
> while looking at the code, i noticed there is now the unused function
> 'parse_content_disposition', so i'd suggest we either use that instead,
> or remove it if we don't need it


we could also just use the existing PVE::Tools::trim() that does what we
want already?


w.r.t. parse_content_disposition: I'm not really sure if that's the best
fit for the altered "architecture" any more, iow. rather no easy one line
+- change. Maybe it's better to drop it, I found no other usage in our
packages.





More information about the pve-devel mailing list