question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

listObjectsV2 when there is & in object name

See original GitHub issue

Version: 7.0.18 Operation: listObjectsV2

When calling putObject operation for a file that contains the char & (example&.pdf), the file is correctly uploaded on minio. The created object has the name example&.pdf. If this object 's key is test/example&.pdf , when we call listObjectsV2 with prefix ‘test/’ the object that is returned, has the name example&.pdf instead of the correct example&.pdf

It is working correctly for version 7.0.16

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
OxComcommented, Sep 28, 2021

Temp solution to decode file names:

export default function decodeFileName(str) {
    // @see https://github.com/minio/minio-js/pull/959/files
    // the objects name from MinIO came as XML encoded lines
    return str
        .replace(/&#(\d+);/g, (match, dec) => String.fromCharCode(dec))
        .replace(/'/g, '\'')
        .replace(/"/g, '"')
        .replace(/>/g, '>')
        .replace(/&lt;/g, '<')
        .replace(/&amp;/g, '&');
}


// ...

const list = [];

s3client
    .listObjectsV2(bucket., prefix, true)
    .on('data', object => {
        list.push(decodeFileName(object.name));
    })

// ...
1reaction
prakashsvmxcommented, Aug 26, 2021

@aloupis Thank you for reporting. The fix is in PR #959

Read more comments on GitHub >

github_iconTop Results From Across the Web

ListObjectsV2 - Amazon Simple Storage Service
Objects are returned sorted in an ascending order of the respective key names in the list. For more information about listing objects, see....
Read more >
list-objects-v2 — AWS CLI 2.9.11 Command Reference
Objects are returned sorted in an ascending order of the respective key names in the list. For more information about listing objects, see...
Read more >
S3 ListObjectsV2 api call not returning contents - Stack Overflow
When a user clicks Create Folder in the Amazon S3 management console, it creates a zero-length object with the same name as the...
Read more >
Object Storage Service:GetBucketV2 (ListObjectsV2)
The objects are returned in alphabetical order of their names. The start-after parameter is used to list the returned objects by page. The...
Read more >
Resolve Access Denied error for ListObjectsV2 using S3 sync
You must have this permission to perform ListObjectsV2 actions. Note: s3:ListBucket is the name of the permission that allows a user to list...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found