Hello,
Is there any validation when it comes to uploading images?
For example, when I upload an XXX.png image that already exists in the assets, is there a kind of pop-up that informs me about it?
“Image XXX already exists”
Or is there possibility to create such as validation information?
Hi Mateusz,
Currently, Builder.io does not provide a built-in feature to notify you if an image already exists in your assets when uploading one. However, you can implement some custom logic or processes to handle this kind of validation. You can use graphQL to fetch all images and names, and, before uploading the image, validate the new asset name if it already exists.
To get all assets using admin API:
Endpoint: https://cdn.builder.io/api/v2/admin
{ "query": "query ($input: QueryAssetsInput!) { assets(input: $input) { name, ownerId, folders, createdDate } }", "variables": { "input": { "query": { "name": { "$regex": "^S", "$options": "i" } }, "sort": { "createdDate": -1 }, "limit": 20 } }}
If you’d like to explore more about how to implement this, the GraphQL API documentation will be beneficial.
Thanks,