Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1f1bcfd

Browse files
committed
Fixed check for stale package_index.json files
1 parent 02d2043 commit 1f1bcfd

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

‎cli/core/search.go‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,18 @@ func indexesNeedUpdating(duration string) bool {
152152
continue
153153
}
154154

155-
coreIndexPath := indexpath.Join(path.Base(URL.Path))
155+
// should handle:
156+
// - package_index.json
157+
// - package_index.json.sig
158+
// - package_index.json.gz
159+
// - package_index.tar.bz2
160+
indexFileName := path.Base(URL.Path)
161+
indexFileName = strings.TrimSuffix(indexFileName, ".tar.bz2")
162+
indexFileName = strings.TrimSuffix(indexFileName, ".gz")
163+
indexFileName = strings.TrimSuffix(indexFileName, ".sig")
164+
indexFileName = strings.TrimSuffix(indexFileName, ".json")
165+
// and obtain package_index.json as result
166+
coreIndexPath := indexpath.Join(indexFileName + ".json")
156167
if coreIndexPath.NotExist() {
157168
return true
158169
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /