Skip to content

Commit

Permalink
fix: use sources directly for Vercel Blob
Browse files Browse the repository at this point in the history
  • Loading branch information
luwes committed Nov 22, 2023
1 parent 91ec3ea commit 2b1922e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 17 deletions.
14 changes: 2 additions & 12 deletions src/providers/vercel-blob/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,7 @@ export async function uploadLocalFile(asset: Asset) {

return updateAsset(src, {
status: 'ready',
providerSpecific: {
[provider]: {
url: blob.url,
contentType: blob.contentType,
}
},
sources: [{ src: blob.url, type: blob.contentType }],
});
}

Expand Down Expand Up @@ -109,11 +104,6 @@ export async function uploadRequestedFile(asset: Asset) {

return updateAsset(src, {
status: 'ready',
providerSpecific: {
[provider]: {
url: blob.url,
contentType: blob.contentType,
}
},
sources: [{ src: blob.url, type: blob.contentType }],
});
}
6 changes: 1 addition & 5 deletions src/providers/vercel-blob/transformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,13 @@ import type { Asset } from '../../assets.js';

export function transform(asset: Asset) {
// Fallback to asset.externalIds for backwards compatibility with older assets.
const providerDetails = asset.providerSpecific?.['vercel-blob'] ?? asset.externalIds;
const providerDetails = asset.externalIds;
if (!providerDetails) return asset;

const source: Record<string, string> = {
src: providerDetails.url
};

if (providerDetails.contentType) {
source.type = providerDetails.contentType;
}

return {
...asset,
sources: [source],
Expand Down

0 comments on commit 2b1922e

Please sign in to comment.