Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Name the uploaded images different #387

Open
Pdzly opened this issue May 7, 2024 · 3 comments
Open

Name the uploaded images different #387

Pdzly opened this issue May 7, 2024 · 3 comments

Comments

@Pdzly
Copy link
Member

Pdzly commented May 7, 2024

Currently if a user uploads "A cute teddybear.jpg" it stays "A cute teddybear..." on the server this could lead to duplicates / errors if another "A cute teddybear" gets uploaded.

I would recommend to name them "{person.id}-{file.name}-{date}"
So it could be identified just by looking into the file name who uploaded it and when.

@Pdzly Pdzly converted this from a draft issue May 7, 2024
@jgrim
Copy link
Member

jgrim commented May 10, 2024

I don't have any issues uploading files with the same name. Have you noticed this issue somehow?

@Pdzly
Copy link
Member Author

Pdzly commented May 23, 2024

@jgrim its rather not good to have the images named like they do originally.

Best it should be directly identifiable e.g. {uploader.id}-{random-hash}.png/jpg/webm

  1. To be able to identify from whom it came, 2. Dont have the mess with duplicates names. Idk what pictrs do with them, override them?

Edit: If lemmy has something different, pictrs just ignores the names and deduplicates it with image file hashes

We dont know if they have it in any meta data but idk

@Security-Chief-Odo
Copy link

Security-Chief-Odo commented Jun 9, 2024

Pictrs doesn't store the actual image file itself, and nowhere on the filesystem or sled repo, is the uploaded file name. The identifier EG: e47-35c3e-95038ded-7a46-4d1a is in the pictrs Database to the filename/path in the Lemmy Database. pictrs uses sled for it's database. Lemmy code connects with it and translates as LEMMY needs, with it's requests/Database.

In pictrs there is no such thing as a 'duplicate filename'. There is a concept of 'duplicate file or file pieces'.

Sled uses modern b-tree techniques such as prefix encoding and suffix truncation for reducing the storage costs of long keys with shared prefixes. If keys are the same length and sequential then the system can avoid storing 99%+ of the key data in most cases, essentially acting like a learned index

ls equiv on the object storage for filenames:

    73689 Images/002/449/684/2bd0ad8e-5c54-4447-891b-e9eaf35c721b
  2348777 Images/002/449/684/6a5955c1-0171-4b43-b6fb-b3b0d0e6673b
    15996 Images/002/449/685/cd0e98a5-892a-41ac-a271-f038c7fcb2bf
     2922 Images/002/449/686/2cc9a21f-e982-4aed-bf4e-6a3963048564

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Ideas
Development

No branches or pull requests

3 participants