Skip to content

Commit 0dafadb

Browse files
committed
Use path.Join
I thought it used OS-dependent separators but only filepath does that.
1 parent 2ef7cdb commit 0dafadb

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

database/nodb.go

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"net/url"
66
"os"
7+
"path"
78
"sort"
89
"strings"
910

@@ -31,13 +32,12 @@ func (db *NoDB) GetExtensionAssetPath(ctx context.Context, asset *Asset, baseURL
3132
fileBase := (&url.URL{
3233
Scheme: baseURL.Scheme,
3334
Host: baseURL.Host,
34-
Path: strings.Join([]string{
35+
Path: path.Join(
3536
baseURL.Path,
3637
"files",
3738
asset.Publisher,
3839
asset.Extension,
39-
asset.Version,
40-
}, "/"),
40+
asset.Version),
4141
}).String()
4242

4343
for _, a := range manifest.Assets.Asset {
@@ -310,13 +310,12 @@ func (db *NoDB) getVersions(ctx context.Context, ext *noDBExtension, flags Flag,
310310
fileBase := (&url.URL{
311311
Scheme: baseURL.Scheme,
312312
Host: baseURL.Host,
313-
Path: strings.Join([]string{
313+
Path: path.Join(
314314
baseURL.Path,
315-
"files",
315+
"/files",
316316
ext.Publisher.PublisherName,
317317
ext.Name,
318-
versionStr,
319-
}, "/"),
318+
versionStr),
320319
}).String()
321320
for _, asset := range manifest.Assets.Asset {
322321
if asset.Addressable != "true" {
@@ -343,13 +342,12 @@ func (db *NoDB) getVersions(ctx context.Context, ext *noDBExtension, flags Flag,
343342
version.AssetURI = (&url.URL{
344343
Scheme: baseURL.Scheme,
345344
Host: baseURL.Host,
346-
Path: strings.Join([]string{
345+
Path: path.Join(
347346
baseURL.Path,
348347
"assets",
349348
ext.Publisher.PublisherName,
350349
ext.Name,
351-
versionStr,
352-
}, "/"),
350+
versionStr),
353351
}).String()
354352
version.FallbackAssetURI = version.AssetURI
355353
}

0 commit comments

Comments
 (0)