mirror of
https://github.com/filebrowser/filebrowser.git
synced 2024-06-07 23:00:43 +00:00
This commit is contained in:
parent
4e28cc13c9
commit
912f27a9e3
@ -24,6 +24,7 @@ import (
|
||||
)
|
||||
|
||||
const PERM = 0664
|
||||
const DIR_PERM = 0755
|
||||
|
||||
// FileInfo describes a file.
|
||||
type FileInfo struct {
|
||||
|
@ -6,6 +6,7 @@ import (
|
||||
"io"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
|
||||
"github.com/spf13/afero"
|
||||
@ -28,6 +29,13 @@ func tusPostHandler() handleFunc {
|
||||
if !d.user.Perm.Create || !d.Check(r.URL.Path) {
|
||||
return http.StatusForbidden, nil
|
||||
}
|
||||
|
||||
dirPath := filepath.Dir(r.URL.Path)
|
||||
if _, statErr := d.user.Fs.Stat(dirPath); os.IsNotExist(statErr) {
|
||||
if mkdirErr := d.user.Fs.MkdirAll(dirPath, files.DIR_PERM); mkdirErr != nil {
|
||||
return http.StatusInternalServerError, err
|
||||
}
|
||||
}
|
||||
case err != nil:
|
||||
return errToStatus(err), err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user