Browse Source

Fix bug in PutObject()

HEAD
Yang Luo 2 years ago
parent
commit
6c214475fd
4 changed files with 18 additions and 5 deletions
  1. +1
    -1
      object/init.go
  2. +1
    -1
      storage/local_file_system.go
  3. +8
    -3
      web/src/FileTree.js
  4. +8
    -0
      web/src/StoreListPage.js

+ 1
- 1
object/init.go View File

@@ -67,7 +67,7 @@ func initBuiltInProvider() {
DisplayName: "Built-in Storage Provider",
Category: "Storage",
Type: "Local File System",
ClientId: "F:/github_repos/casdoor-website",
ClientId: "C:/casibase_storage",
}
_, err = AddProvider(provider)
if err != nil {


+ 1
- 1
storage/local_file_system.go View File

@@ -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 {
fullPath := p.path
fullPath := filepath.Join(p.path, key)

err := os.MkdirAll(filepath.Dir(fullPath), os.ModePerm)
if err != nil {


+ 8
- 3
web/src/FileTree.js View File

@@ -176,11 +176,16 @@ class FileTree extends React.Component {

Promise.all(promises)
.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 => {
Setting.showMessage("error", `File failed to upload: ${error}`);
Setting.showMessage("error", `File failed to add: ${error}`);
});
}



+ 8
- 0
web/src/StoreListPage.js View File

@@ -147,6 +147,14 @@ class StoreListPage extends React.Component {
return null;
}
if (text.includes("local") || text.includes("built-in")) {
return (
<Link to={`/providers/${text}`}>
{text}
</Link>
);
}
return (
<a target="_blank" rel="noreferrer" href={Setting.getMyProfileUrl(this.props.account).replace("/account", `/providers/admin/${text}`)}>
{text}


Loading…
Cancel
Save