Closed
Description
The documentation states that the default behaviour is false
but it still adds a random suffix...
In the source the default behaviour is defined as true
so at least the documentation can be updated to reflect that.
But after I tried explicitly defining the blob options with { addRandomSuffix: false }
, it still adds a suffix...
Am I missing something?
This is my event handler:
import destr from 'destr';
export default defineEventHandler(async (event) => {
const shopId = parseIdParam(event);
const form = await readFormData(event);
const file = form.get('file') as File;
const metaData = destr<Record<string, string>>(form.get('metaData'), {});
consola.debug('File:', file);
consola.debug('Meta data:', metaData);
if (!file || !file.size)
throw createError({ statusCode: 400, message: 'No file provided' });
ensureBlob(file, { maxSize: '1MB', types: ['image/jpeg'] });
return hubBlob().put(`images/shop/${shopId}.jpg`, file, { addRandomSuffix: false });
});
shopId
is a nano id (urxyfivpe2mg
) but when I look in cloudflare I see the following urxyfivpe2mg-27828ff2.jpg
Also, would be cool if the blob admin could have folders like they have on the cloudflare dashboard.