ETags in returned XML are missing quotes #190

Closed
opened 2022-01-12 07:24:50 +00:00 by lx · 3 comments
Owner

XML returned by AWS S3 normally looks like this when it contains an ETag field:

<CopyPartResult><LastModified>2011-04-11T20:34:56.000Z</LastModified><ETag>"9b2cf535f27731c974343645a3985328"</ETag></CopyPartResult>

Garage currently returns XML that looks like this:

<CopyPartResult><LastModified>2011-04-11T20:34:56.000Z</LastModified><ETag>9b2cf535f27731c974343645a3985328</ETag></CopyPartResult>

If we add the quotes to the value of the field, quick_xml serializes it like this:

<CopyPartResult><LastModified>2011-04-11T20:34:56.000Z</LastModified><ETag>&quot;9b2cf535f27731c974343645a3985328&quot;</ETag></CopyPartResult>

Which is bad. Fixing this depends on the following feature of the quick_xml crate: https://github.com/tafia/quick-xml/issues/350

XML returned by AWS S3 normally looks like this when it contains an ETag field: ```xml <CopyPartResult><LastModified>2011-04-11T20:34:56.000Z</LastModified><ETag>"9b2cf535f27731c974343645a3985328"</ETag></CopyPartResult> ``` Garage currently returns XML that looks like this: ```xml <CopyPartResult><LastModified>2011-04-11T20:34:56.000Z</LastModified><ETag>9b2cf535f27731c974343645a3985328</ETag></CopyPartResult> ``` If we add the quotes to the value of the field, `quick_xml` serializes it like this: ```xml <CopyPartResult><LastModified>2011-04-11T20:34:56.000Z</LastModified><ETag>&quot;9b2cf535f27731c974343645a3985328&quot;</ETag></CopyPartResult> ``` Which is bad. Fixing this depends on the following feature of the `quick_xml` crate: https://github.com/tafia/quick-xml/issues/350
lx added the
Bug
S3 Compatibility
labels 2022-01-12 07:24:50 +00:00

Actually AWS encode quotes like quick_xml does

Sample response obtained from AWS
<?xml version="1.0" encoding="UTF-8"?>
<ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
    <Name>trinity-1686a</Name>
    <Prefix></Prefix>
    <KeyCount>1</KeyCount>
    <MaxKeys>1000</MaxKeys>
    <Delimiter>/</Delimiter>
    <EncodingType>url</EncodingType>
    <IsTruncated>false</IsTruncated>
    <Contents>
        <Key>Makefile</Key>
        <LastModified>2021-12-18T15:35:01.000Z</LastModified>
        <ETag>&quot;34dbf6d2bac228690f5cea2ee618ae39&quot;</ETag>
        <Size>148</Size>
        <StorageClass>STANDARD</StorageClass>
    </Contents>
</ListBucketResult>    

(indentation added by myself for readability)

Actually AWS encode quotes like quick_xml does <details> <summary>Sample response obtained from AWS</summary> ```xml <?xml version="1.0" encoding="UTF-8"?> <ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <Name>trinity-1686a</Name> <Prefix></Prefix> <KeyCount>1</KeyCount> <MaxKeys>1000</MaxKeys> <Delimiter>/</Delimiter> <EncodingType>url</EncodingType> <IsTruncated>false</IsTruncated> <Contents> <Key>Makefile</Key> <LastModified>2021-12-18T15:35:01.000Z</LastModified> <ETag>&quot;34dbf6d2bac228690f5cea2ee618ae39&quot;</ETag> <Size>148</Size> <StorageClass>STANDARD</StorageClass> </Contents> </ListBucketResult> ``` (indentation added by myself for readability) </details>
Author
Owner

Thanks @trinity-1686a, so we just need to add the quotes where they are missing.

Thanks @trinity-1686a, so we just need to add the quotes where they are missing.
Author
Owner

Fixed in #188

Fixed in #188
lx closed this issue 2022-01-13 13:19:11 +00:00
Sign in to join this conversation.
No Milestone
No Assignees
2 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#190
No description provided.