Commit 912f27a 1 parent 4e28cc1 commit 912f27a Copy full SHA for 912f27a
File tree 2 files changed +9
-0
lines changed
2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ import (
24
24
)
25
25
26
26
const PERM = 0664
27
+ const DIR_PERM = 0755
27
28
28
29
// FileInfo describes a file.
29
30
type FileInfo struct {
Original file line number Diff line number Diff line change 6
6
"io"
7
7
"net/http"
8
8
"os"
9
+ "path/filepath"
9
10
"strconv"
10
11
11
12
"github.com/spf13/afero"
@@ -28,6 +29,13 @@ func tusPostHandler() handleFunc {
28
29
if ! d .user .Perm .Create || ! d .Check (r .URL .Path ) {
29
30
return http .StatusForbidden , nil
30
31
}
32
+
33
+ dirPath := filepath .Dir (r .URL .Path )
34
+ if _ , statErr := d .user .Fs .Stat (dirPath ); os .IsNotExist (statErr ) {
35
+ if mkdirErr := d .user .Fs .MkdirAll (dirPath , files .DIR_PERM ); mkdirErr != nil {
36
+ return http .StatusInternalServerError , err
37
+ }
38
+ }
31
39
case err != nil :
32
40
return errToStatus (err ), err
33
41
}
You can’t perform that action at this time.
0 commit comments