fix (share): access when redirection is enabled

This commit is contained in:
Mickael Kerjean 2021-11-05 18:23:03 +11:00
parent 095876d450
commit b8bc56aea2
2 changed files with 15 additions and 7 deletions

View file

@ -16,7 +16,8 @@ export class SharePage extends React.Component {
path: null,
key: null,
error: null,
loading: false
loading: false,
isUploader: false,
};
}
@ -44,7 +45,8 @@ export class SharePage extends React.Component {
key: res.key,
path: res.path || null,
share: res.id,
loading: false
loading: false,
isUploader: res.can_read === false && res.can_write === false && res.can_upload === true,
};
if(res.message){
notify.send(res.message, "info");
@ -81,7 +83,7 @@ export class SharePage extends React.Component {
);
}
notify.send(t("You can't do that :)"), "error");
} else if (CONFIG["share_redirect"] !== "") {
} else if (CONFIG["share_redirect"] !== "" && this.state.isUploader === false) {
requestAnimationFrame(() => {
window.location.href = CONFIG["share_redirect"].replace("{{path}}", this.state.path);
});

View file

@ -174,10 +174,16 @@ func ShareVerifyProof(ctx App, res http.ResponseWriter, req *http.Request) {
}
SendSuccessResult(res, struct {
Id string `json:"id"`
Path string `json:"path"`
Id string `json:"id"`
Path string `json:"path"`
CanRead bool `json:"can_read"`
CanWrite bool `json:"can_write"`
CanUpload bool `json:"can_upload"`
}{
Id: s.Id,
Path: s.Path,
Id: s.Id,
Path: s.Path,
CanRead: s.CanRead,
CanWrite: s.CanWrite,
CanUpload: s.CanUpload,
})
}