cmj2002 / r2-dir-list

Directory Listing for Cloudflare R2
MIT License
25 stars 8 forks source link

[+] Doesn't list all objects #1

Closed Azathothas closed 7 months ago

Azathothas commented 7 months ago

Hi, thank you so much for this.

I have deployed this on https://bin.ajam.dev however it's not listing all objects from the bucket. For example:

❯ curl -qfsSL "https://bin.ajam.dev/x86_64_Linux/METADATA.json" | jq -r '.[].Name' | sort -u | wc -l
601

❯ curl -qfsSL "https://bin.ajam.dev/x86_64_Linux/METADATA.json" | jq -r '.[].Name' | sort -u | tail -n 5
zenith
zfxtop
zgrab2
zoxide
zstd

Whereas, it's being truncated here: https://bin.ajam.dev/x86_64_Linux/ image

This is only the 572nd entry: https://bin.ajam.dev/x86_64_Linux/METADATA.json image

I don't know TS/JS, but is this line any relevant: https://github.com/cmj2002/r2-dir-list/blob/de8fbbaf9d312dc594888062629b1ac4ccffd36b/src/index.ts#L24

        const index = await bucket.list({
            // TODO: Should manage limit here, but since I won't have more than 1000 files in a single folder, I just ignore it
            prefix: objectKey,
            delimiter: '/',
            include: ['httpMetadata', 'customMetadata']
        });
cmj2002 commented 7 months ago

Try to deploy branch manage-limit, it may solve the problem. If it works, I will merge it into main branch.

Azathothas commented 7 months ago

@cmj2002 Yes it works, thank you again.

I have deployed with the new index.ts at : https://github.com/Azathothas/bin.ajam.dev

https://bin.ajam.dev/x86_64_Linux/ image