Skip to content

Commit

Permalink
fix: add back support for string arg
Browse files Browse the repository at this point in the history
  • Loading branch information
wa0x6e committed Oct 17, 2023
1 parent 8634bd7 commit 5cfc134
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/providers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ type ProviderType = 'image' | 'json';
export default function uploadToProviders(
providers: string[],
type: ProviderType,
payload: Buffer
payload: string | Buffer
) {
const configuredProviders = providers.filter(p => providersMap[p].isConfigured());

Expand All @@ -20,7 +20,9 @@ export default function uploadToProviders(
countOpenProvidersRequest.inc({ name, type });

const result = await providersMap[name].set(payload);
providersUploadSize.inc({ name, type }, payload.length);
const size = (payload instanceof Buffer ? payload : Buffer.from(JSON.stringify(payload)))
.length;
providersUploadSize.inc({ name, type }, size);
status = 1;

return result;
Expand Down

0 comments on commit 5cfc134

Please sign in to comment.