Skip to content

Commit d487570

Browse files
authored
Merge pull request #558 from rusq/i554
Rollback changes to standard fs from #522
2 parents faaddb2 + dd85efd commit d487570

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

source/filestorage.go

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -228,16 +228,14 @@ func (r *STStandard) FilePath(ci *slack.Channel, f *slack.File) string {
228228
}
229229

230230
func (r *STStandard) File(id string, name string) (string, error) {
231-
// Try sanitized name first
232-
for _, pth := range []string{
233-
id + "-" + SanitizeFilename(name),
234-
id + "-" + name, // fallback for legacy
235-
} {
236-
if _, err := fs.Stat(r.fs, pth); err == nil {
237-
return pth, nil
238-
}
231+
pth, ok := r.idx[id]
232+
if !ok {
233+
return "", fs.ErrNotExist
239234
}
240-
return "", fs.ErrNotExist
235+
if _, err := fs.Stat(r.fs, pth); err != nil {
236+
return "", err
237+
}
238+
return pth, nil
241239
}
242240

243241
type fakefs struct{}

0 commit comments

Comments
 (0)