File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -52,6 +52,13 @@ func isMigrateURLAllowed(remoteURL string) error {
52
52
}
53
53
}
54
54
55
+ if u .Host == "" {
56
+ if ! setting .ImportLocalPaths {
57
+ return & models.ErrMigrationNotAllowed {Host : "<LOCAL_FILESYSTEM>" }
58
+ }
59
+ return nil
60
+ }
61
+
55
62
if ! setting .Migrations .AllowLocalNetworks {
56
63
addrList , err := net .LookupIP (strings .Split (u .Host , ":" )[0 ])
57
64
if err != nil {
Original file line number Diff line number Diff line change @@ -31,4 +31,16 @@ func TestMigrateWhiteBlocklist(t *testing.T) {
31
31
32
32
err = isMigrateURLAllowed ("https://github.com/go-gitea/gitea.git" )
33
33
assert .Error (t , err )
34
+
35
+ old := setting .ImportLocalPaths
36
+ setting .ImportLocalPaths = false
37
+
38
+ err = isMigrateURLAllowed ("/home/foo/bar/goo" )
39
+ assert .Error (t , err )
40
+
41
+ setting .ImportLocalPaths = true
42
+ err = isMigrateURLAllowed ("/home/foo/bar/goo" )
43
+ assert .NoError (t , err )
44
+
45
+ setting .ImportLocalPaths = old
34
46
}
You can’t perform that action at this time.
0 commit comments