Skip to content
This repository was archived by the owner on Feb 24, 2026. It is now read-only.

Commit 8a2fff1

Browse files
committed
fix: use content type returned from the API when uploading files using presigned URLs
1 parent bdf5dbc commit 8a2fff1

3 files changed

Lines changed: 12 additions & 36 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# flowershow
22

3+
## 0.2.12
4+
5+
### Patch Changes
6+
7+
- Use content type returned from the API when uploading files using presigned URLs.
8+
39
## 0.2.11
410

511
### Patch Changes

lib/commands/publish.ts

Lines changed: 5 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -24,39 +24,6 @@ interface UploadResult {
2424
error?: string;
2525
}
2626

27-
/**
28-
* Get content type based on file extension
29-
*/
30-
function getContentType(extension: string): string {
31-
const contentTypes: Record<string, string> = {
32-
md: "text/markdown",
33-
mdx: "text/markdown",
34-
csv: "text/csv",
35-
geojson: "application/geo+json",
36-
json: "application/json",
37-
yaml: "application/yaml",
38-
yml: "application/yaml",
39-
base: "application/yaml",
40-
css: "text/css",
41-
jpeg: "image/jpeg",
42-
jpg: "image/jpeg",
43-
png: "image/png",
44-
gif: "image/gif",
45-
svg: "image/svg+xml",
46-
ico: "image/x-icon",
47-
webp: "image/webp",
48-
avif: "image/avif",
49-
pdf: "application/pdf",
50-
mp4: "video/mp4",
51-
webm: "video/webm",
52-
aac: "audio/aac",
53-
mp3: "audio/mpeg",
54-
opus: "audio/opus",
55-
};
56-
57-
return contentTypes[extension] || "application/octet-stream";
58-
}
59-
6027
/**
6128
* Publish command - upload files to FlowerShow
6229
* @param inputPaths - Path(s) to the file(s) or folder to publish
@@ -172,8 +139,11 @@ export async function publishCommand(
172139
}
173140

174141
try {
175-
const contentType = getContentType(file.extension);
176-
await uploadToR2(uploadInfo.uploadUrl, file.content, contentType);
142+
await uploadToR2(
143+
uploadInfo.uploadUrl,
144+
file.content,
145+
uploadInfo.contentType
146+
);
177147
uploadResults.push({ path: file.path, success: true });
178148
uploadBar.increment();
179149
} catch (error) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "flowershow",
3-
"version": "0.2.11",
3+
"version": "0.2.12",
44
"description": "CLI tool for publishing to FlowerShow",
55
"type": "module",
66
"main": "./dist/cli.js",

0 commit comments

Comments
 (0)