File tree 2 files changed +6
-5
lines changed
2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ Andrew Reid <andrew.reid at tixtrack.com>
20
20
Animesh Ray <mail.rayanimesh at gmail.com>
21
21
Arne Hormann <arnehormann at gmail.com>
22
22
Ariel Mashraki <ariel at mashraki.co.il>
23
+ Artur Melanchyk <artur.melanchyk@gmail.com>
23
24
Asta Xie <xiemengjun at gmail.com>
24
25
B Lamarche <blam413 at gmail.com>
25
26
Brian Hendriks <brian at dolthub.com>
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ import (
17
17
)
18
18
19
19
var (
20
- fileRegister map [string ]bool
20
+ fileRegister map [string ]struct {}
21
21
fileRegisterLock sync.RWMutex
22
22
readerRegister map [string ]func () io.Reader
23
23
readerRegisterLock sync.RWMutex
@@ -37,10 +37,10 @@ func RegisterLocalFile(filePath string) {
37
37
fileRegisterLock .Lock ()
38
38
// lazy map init
39
39
if fileRegister == nil {
40
- fileRegister = make (map [string ]bool )
40
+ fileRegister = make (map [string ]struct {} )
41
41
}
42
42
43
- fileRegister [strings .Trim (filePath , `"` )] = true
43
+ fileRegister [strings .Trim (filePath , `"` )] = struct {}{}
44
44
fileRegisterLock .Unlock ()
45
45
}
46
46
@@ -123,9 +123,9 @@ func (mc *okHandler) handleInFileRequest(name string) (err error) {
123
123
} else { // File
124
124
name = strings .Trim (name , `"` )
125
125
fileRegisterLock .RLock ()
126
- fr := fileRegister [name ]
126
+ _ , exists := fileRegister [name ]
127
127
fileRegisterLock .RUnlock ()
128
- if mc .cfg .AllowAllFiles || fr {
128
+ if mc .cfg .AllowAllFiles || exists {
129
129
var file * os.File
130
130
var fi os.FileInfo
131
131
You can’t perform that action at this time.
0 commit comments