diff options
author | 2021-08-14 02:39:44 -0700 | |
---|---|---|
committer | 2021-08-14 02:39:44 -0700 | |
commit | 16c76743048ef905269e2711cb0148ecc4e57f3f (patch) | |
tree | a8fb11b55767945a47e92120179f2f762b1f8e99 /src/linker.zig | |
parent | f59892f647ceef1c05e40c9cdef4f79d0a530c2f (diff) | |
download | bun-16c76743048ef905269e2711cb0148ecc4e57f3f.tar.gz bun-16c76743048ef905269e2711cb0148ecc4e57f3f.tar.zst bun-16c76743048ef905269e2711cb0148ecc4e57f3f.zip |
lots
Former-commit-id: 0b8128cb3b4db02f9d33331b4c2c1b595156e6c8
Diffstat (limited to 'src/linker.zig')
-rw-r--r-- | src/linker.zig | 37 |
1 files changed, 8 insertions, 29 deletions
diff --git a/src/linker.zig b/src/linker.zig index 5073e88cf..018db3528 100644 --- a/src/linker.zig +++ b/src/linker.zig @@ -460,6 +460,7 @@ pub fn NewLinker(comptime BundlerType: type) type { }, .relative => { var relative_name = linker.fs.relative(source_dir, source_path); + var pretty: string = undefined; if (use_hashed_name) { var basepath = Fs.Path.init(source_path); @@ -529,35 +530,13 @@ pub fn NewLinker(comptime BundlerType: type) type { basename = try linker.getHashedFilename(basepath, null); } - const needs_slash = dirname.len > 0 and dirname[dirname.len - 1] != '/'; - - if (needs_slash) { - const absolute_url = try std.fmt.allocPrint( - linker.allocator, - "{s}{s}/{s}{s}", - .{ - linker.options.origin, - dirname, - basename, - absolute_pathname.ext, - }, - ); - - return Fs.Path.initWithPretty(absolute_url, absolute_url); - } else { - const absolute_url = try std.fmt.allocPrint( - linker.allocator, - "{s}{s}{s}{s}", - .{ - linker.options.origin, - dirname, - basename, - absolute_pathname.ext, - }, - ); - - return Fs.Path.initWithPretty(absolute_url, absolute_url); - } + return Fs.Path.init(try linker.options.origin.joinAlloc( + linker.allocator, + linker.options.routes.asset_prefix_path, + dirname, + basename, + absolute_pathname.ext, + )); }, else => unreachable, |