8000 [Blob] How does `addRandomSuffix` behave? · Issue #88 · nuxt-hub/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
[Blob] How does addRandomSuffix behave? #88
Closed
@Gerbuuun

Description

@Gerbuuun

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0