Multipart uploads fail when the key contains an & (ampersand) #59

Closed
opened 2021-04-27 17:21:48 +00:00 by quentin · 0 comments
Owner

How to reproduce the bug

Create a file big enough to trigger a multipart upload.

dd if=/dev/urandom of=a.bin bs=1M count=129

Try to upload it in a key containing an ampersand.

mc cp 'a.bin' 'garage/quentin.bibliotheque/&'

What we obtain

mc: <ERROR> Failed to copy `a.bin`. XML syntax error on line 4: invalid character entity & (no semicolon)

What we expect

The same result than the one we have with non-multipart uploads:

dd if=/dev/urandom of=a.bin bs=1k count=129
mc cp 'a.bin' 'garage/quentin.bibliotheque/&'

Which gives us a successful upload

$ mc cp 'a.bin' 'garage/quentin.bibliotheque/&'
a.bin:                    129.00 KiB / 129.00 KiB
[==============================================================] 160.20 KiB/s 0s
$ mc ls 'garage/quentin.bibliotheque/&'
[2021-04-27 19:19:55 CEST] 129KiB &

Investigations

I did not have time to investigate the bug but I suspect that the bug is due to how we template XML files. I will try to investigate soon.

## How to reproduce the bug Create a file big enough to trigger a multipart upload. ```bash dd if=/dev/urandom of=a.bin bs=1M count=129 ``` Try to upload it in a key containing an ampersand. ```bash mc cp 'a.bin' 'garage/quentin.bibliotheque/&' ``` ## What we obtain ``` mc: <ERROR> Failed to copy `a.bin`. XML syntax error on line 4: invalid character entity & (no semicolon) ``` ## What we expect The same result than the one we have with non-multipart uploads: ```bash dd if=/dev/urandom of=a.bin bs=1k count=129 mc cp 'a.bin' 'garage/quentin.bibliotheque/&' ``` Which gives us a successful upload ``` $ mc cp 'a.bin' 'garage/quentin.bibliotheque/&' a.bin: 129.00 KiB / 129.00 KiB [==============================================================] 160.20 KiB/s 0s $ mc ls 'garage/quentin.bibliotheque/&' [2021-04-27 19:19:55 CEST] 129KiB & ``` ## Investigations I did not have time to investigate the bug but I suspect that the bug is due to how we template XML files. I will try to investigate soon.
quentin added the
Bug
label 2021-04-27 17:21:48 +00:00
quentin self-assigned this 2021-04-27 17:21:48 +00:00
lx referenced this issue from a commit 2021-04-27 21:11:12 +00:00
lx closed this issue 2021-04-27 21:15:05 +00:00
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: Deuxfleurs/garage#59
No description provided.