Skip to content

Commit d8d4490

Browse files
committed
fix(video): use f_auto:video for video URL optimization
- Changed fetch_format transformation for videos from 'auto' to 'auto:video' - Ensures proper video codec and format optimization - Images continue to use 'auto' format
1 parent 0aed550 commit d8d4490

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/tree/cloudinaryItem.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,10 @@ class CloudinaryItem extends vscode.TreeItem {
6666
: cloudinary.url(data.public_id, {
6767
resource_type: assetType,
6868
type: data.type,
69-
transformation: [{ fetch_format: 'auto' }, { quality: 'auto' }],
69+
transformation: [
70+
{ fetch_format: assetType === 'video' ? 'auto:video' : 'auto' },
71+
{ quality: 'auto' }
72+
],
7073
});
7174

7275
data.optimized_url = optimizedUrl;
@@ -130,15 +133,15 @@ class CloudinaryItem extends vscode.TreeItem {
130133
}
131134

132135
function truncateLabel(label: string, maxLength: number = 20): string {
133-
if (label.length <= maxLength) {return label;}
136+
if (label.length <= maxLength) { return label; }
134137
const extension = label.includes('.') ? label.split('.').pop() : '';
135138
const nameWithoutExt = extension ? label.slice(0, -(extension.length + 1)) : label;
136139
const truncatedName = nameWithoutExt.slice(0, maxLength - 3) + '...';
137140
return extension ? `${truncatedName}.${extension}` : truncatedName;
138141
}
139142

140143
function formatFileSize(bytes: number): string {
141-
if (bytes === 0) {return '0 B';}
144+
if (bytes === 0) { return '0 B'; }
142145
const k = 1024;
143146
const sizes = ['B', 'KB', 'MB', 'GB'];
144147
const i = Math.floor(Math.log(bytes) / Math.log(k));

0 commit comments

Comments
 (0)