Skip to content

Commit

Permalink
Use path.join to form urls (#389)
Browse files Browse the repository at this point in the history
  • Loading branch information
3b1b committed Jan 24, 2024
1 parent 7dc8c96 commit 244dd23
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions util/transformSrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { bucket } from "../data/site.yaml";
const path = require('path');

// change provided srcs (png & mp4) to external bucket location for production.
export const transformSrc = (src, dir = "") => {
Expand All @@ -13,8 +14,8 @@ export const transformSrc = (src, dir = "") => {
process.env.NEXT_PUBLIC_NETLIFY_CONTEXT === "production" && // Not a deploy preview
!src.endsWith("svg")
) {
return bucket + dir + src;
return path.join(bucket, dir, src);
} else {
return dir + src;
return path.join(dir, src);
}
};

0 comments on commit 244dd23

Please sign in to comment.