all repos — homestead @ 40f8ccfdf0c8a5855cdc211096f86459b28a261b

Code for my website

promote early returns

Alan Pearce
commit

40f8ccfdf0c8a5855cdc211096f86459b28a261b

parent

a0bb10d9dea0d560a0ca4ccc7d9d4bf3848242e7

1 file changed, 5 insertions(+), 6 deletions(-)

changed files
M shared/storage/files/reader.goshared/storage/files/reader.go
@@ -75,6 +75,10 @@ }
if f.IsDir() { return nil } + switch filepath.Ext(filePath) { + case ".br", ".gz", ".zstd": + return nil + } relPath, err := filepath.Rel(r.root, filePath) if err != nil {
@@ -83,13 +87,8 @@ err,
fmsg.With(fmt.Sprintf("failed to make path relative, path: %s", filePath)), ) } - urlPath := fileNameToPathName("/" + relPath) - switch filepath.Ext(relPath) { - case ".br", ".gz", ".zstd": - return nil - } - + urlPath := fileNameToPathName("/" + relPath) r.log.Debug("registering file", "url", urlPath, "filename", relPath) return r.registerFile(urlPath, filePath)