| @@ -67,7 +67,7 @@ func initBuiltInProvider() { | |||||
| DisplayName: "Built-in Storage Provider", | DisplayName: "Built-in Storage Provider", | ||||
| Category: "Storage", | Category: "Storage", | ||||
| Type: "Local File System", | Type: "Local File System", | ||||
| ClientId: "F:/github_repos/casdoor-website", | |||||
| ClientId: "C:/casibase_storage", | |||||
| } | } | ||||
| _, err = AddProvider(provider) | _, err = AddProvider(provider) | ||||
| if err != nil { | if err != nil { | ||||
| @@ -70,7 +70,7 @@ func (p *LocalFileSystemStorageProvider) ListObjects(prefix string) ([]*Object, | |||||
| } | } | ||||
| func (p *LocalFileSystemStorageProvider) PutObject(user string, parent string, key string, fileBuffer *bytes.Buffer) error { | func (p *LocalFileSystemStorageProvider) PutObject(user string, parent string, key string, fileBuffer *bytes.Buffer) error { | ||||
| fullPath := p.path | |||||
| fullPath := filepath.Join(p.path, key) | |||||
| err := os.MkdirAll(filepath.Dir(fullPath), os.ModePerm) | err := os.MkdirAll(filepath.Dir(fullPath), os.ModePerm) | ||||
| if err != nil { | if err != nil { | ||||
| @@ -176,11 +176,16 @@ class FileTree extends React.Component { | |||||
| Promise.all(promises) | Promise.all(promises) | ||||
| .then((values) => { | .then((values) => { | ||||
| Setting.showMessage("success", "File uploaded successfully"); | |||||
| this.props.onRefresh(); | |||||
| const res = values[0]; | |||||
| if (res.status === "ok") { | |||||
| Setting.showMessage("success", "File added successfully"); | |||||
| this.props.onRefresh(); | |||||
| } else { | |||||
| Setting.showMessage("error", `File failed to add: ${res.msg}`); | |||||
| } | |||||
| }) | }) | ||||
| .catch(error => { | .catch(error => { | ||||
| Setting.showMessage("error", `File failed to upload: ${error}`); | |||||
| Setting.showMessage("error", `File failed to add: ${error}`); | |||||
| }); | }); | ||||
| } | } | ||||
| @@ -147,6 +147,14 @@ class StoreListPage extends React.Component { | |||||
| return null; | return null; | ||||
| } | } | ||||
| if (text.includes("local") || text.includes("built-in")) { | |||||
| return ( | |||||
| <Link to={`/providers/${text}`}> | |||||
| {text} | |||||
| </Link> | |||||
| ); | |||||
| } | |||||
| return ( | return ( | ||||
| <a target="_blank" rel="noreferrer" href={Setting.getMyProfileUrl(this.props.account).replace("/account", `/providers/admin/${text}`)}> | <a target="_blank" rel="noreferrer" href={Setting.getMyProfileUrl(this.props.account).replace("/account", `/providers/admin/${text}`)}> | ||||
| {text} | {text} | ||||