Skip to content

Commit 2abcfbb

Browse files
author
Phil Hawksworth
committed
utility filter to format cloudinary URL params
1 parent e1f8b63 commit 2abcfbb

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

.eleventy.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,13 +165,15 @@ module.exports = function(eleventyConfig) {
165165
eleventyConfig.addFilter("cloudinaryifyPath", (str) => {
166166

167167
if(str) {
168-
// we need to double escape some characters which might appear in text
168+
169+
// add generic url encoding
170+
str = encodeURI(str);
171+
172+
// we also need to double escape some characters which might appear in text
169173
// but are meaningful in cloudinary URLs
170174
str = str.replace(/,/g, '%252C');
171175
str = str.replace(/\//g, '%252F');
172176

173-
// add generic url encoding
174-
str = encodeURI(str);
175177
}
176178
return str;
177179
});

0 commit comments

Comments
 (0)