mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-08 18:30:53 +00:00
repair upload file bug in shared uploaded link
This commit is contained in:
@@ -27,6 +27,7 @@ const propTypes = {
|
|||||||
fileTypeErrorCallback: PropTypes.func,
|
fileTypeErrorCallback: PropTypes.func,
|
||||||
dragAndDrop: PropTypes.bool.isRequired,
|
dragAndDrop: PropTypes.bool.isRequired,
|
||||||
path: PropTypes.string.isRequired,
|
path: PropTypes.string.isRequired,
|
||||||
|
uploadUrlPath: PropTypes.string.isRequired,
|
||||||
onFileUploadSuccess: PropTypes.func.isRequired
|
onFileUploadSuccess: PropTypes.func.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -203,8 +204,8 @@ class FileUploader extends React.Component {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.setUploadFileList(this.resumable.files);
|
this.setUploadFileList(this.resumable.files);
|
||||||
let { token } = this.props;
|
let { token, uploadUrlPath } = this.props;
|
||||||
seafileAPI.sharedLinkGetFileUploadUrl(token).then(res => {
|
seafileAPI.sharedLinkGetFileUploadUrl(token, uploadUrlPath).then(res => {
|
||||||
this.resumable.opts.target = res.data.upload_link + '?ret-json=1';
|
this.resumable.opts.target = res.data.upload_link + '?ret-json=1';
|
||||||
this.resumableUpload(resumableFile);
|
this.resumableUpload(resumableFile);
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
@@ -216,8 +217,8 @@ class FileUploader extends React.Component {
|
|||||||
this.setUploadFileList(this.resumable.files);
|
this.setUploadFileList(this.resumable.files);
|
||||||
if (!this.isUploadLinkLoaded) {
|
if (!this.isUploadLinkLoaded) {
|
||||||
this.isUploadLinkLoaded = true;
|
this.isUploadLinkLoaded = true;
|
||||||
let { token } = this.props;
|
let { token, uploadUrlPath } = this.props;
|
||||||
seafileAPI.sharedLinkGetFileUploadUrl(token).then(res => {
|
seafileAPI.sharedLinkGetFileUploadUrl(token, uploadUrlPath).then(res => {
|
||||||
this.resumable.opts.target = res.data.upload_link + '?ret-json=1';
|
this.resumable.opts.target = res.data.upload_link + '?ret-json=1';
|
||||||
this.resumable.upload();
|
this.resumable.upload();
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
@@ -563,8 +564,8 @@ class FileUploader extends React.Component {
|
|||||||
|
|
||||||
onUploadRetry = (resumableFile) => {
|
onUploadRetry = (resumableFile) => {
|
||||||
|
|
||||||
let { token } = this.props;
|
let { token, uploadUrlPath } = this.props;
|
||||||
seafileAPI.sharedLinkGetFileUploadUrl(token).then(res => {
|
seafileAPI.sharedLinkGetFileUploadUrl(token, uploadUrlPath).then(res => {
|
||||||
this.resumable.opts.target = res.data.upload_link + '?ret-json=1';
|
this.resumable.opts.target = res.data.upload_link + '?ret-json=1';
|
||||||
|
|
||||||
let retryFileList = this.state.retryFileList.filter(item => {
|
let retryFileList = this.state.retryFileList.filter(item => {
|
||||||
@@ -590,8 +591,8 @@ class FileUploader extends React.Component {
|
|||||||
|
|
||||||
onUploadRetryAll = () => {
|
onUploadRetryAll = () => {
|
||||||
|
|
||||||
let { token } = this.props;
|
let { token, uploadUrlPath } = this.props;
|
||||||
seafileAPI.sharedLinkGetFileUploadUrl(token).then(res => {
|
seafileAPI.sharedLinkGetFileUploadUrl(token, uploadUrlPath).then(res => {
|
||||||
this.resumable.opts.target = res.data.upload_link + '?ret-json=1';
|
this.resumable.opts.target = res.data.upload_link + '?ret-json=1';
|
||||||
this.state.retryFileList.forEach(item => {
|
this.state.retryFileList.forEach(item => {
|
||||||
item.error = false;
|
item.error = false;
|
||||||
@@ -644,8 +645,8 @@ class FileUploader extends React.Component {
|
|||||||
uploadFile = () => {
|
uploadFile = () => {
|
||||||
let resumableFile = this.resumable.files[this.resumable.files.length - 1];
|
let resumableFile = this.resumable.files[this.resumable.files.length - 1];
|
||||||
|
|
||||||
let { token } = this.props;
|
let { token, uploadUrlPath } = this.props;
|
||||||
seafileAPI.sharedLinkGetFileUploadUrl(token).then(res => {
|
seafileAPI.sharedLinkGetFileUploadUrl(token, uploadUrlPath).then(res => {
|
||||||
this.resumable.opts.target = res.data.upload_link + '?ret-json=1';
|
this.resumable.opts.target = res.data.upload_link + '?ret-json=1';
|
||||||
this.setState({
|
this.setState({
|
||||||
isUploadRemindDialogShow: false,
|
isUploadRemindDialogShow: false,
|
||||||
|
@@ -19,7 +19,7 @@ import './css/grid-view.css';
|
|||||||
moment.locale(window.app.config.lang);
|
moment.locale(window.app.config.lang);
|
||||||
|
|
||||||
let loginUser = window.app.pageOptions.name;
|
let loginUser = window.app.pageOptions.name;
|
||||||
const {
|
let {
|
||||||
token, dirName, dirPath, sharedBy,
|
token, dirName, dirPath, sharedBy,
|
||||||
repoID, path,
|
repoID, path,
|
||||||
mode, thumbnailSize, zipped,
|
mode, thumbnailSize, zipped,
|
||||||
@@ -27,6 +27,8 @@ const {
|
|||||||
noQuota, canUpload
|
noQuota, canUpload
|
||||||
} = window.shared.pageOptions;
|
} = window.shared.pageOptions;
|
||||||
|
|
||||||
|
dirPath = dirPath.replace(/\/+$/, ""); // used for upload file
|
||||||
|
const uploadUrlPath = path.replace(/\/+$/, ""); // used for get dir upload link
|
||||||
const showDownloadIcon = !trafficOverLimit && canDownload;
|
const showDownloadIcon = !trafficOverLimit && canDownload;
|
||||||
|
|
||||||
class SharedDirView extends React.Component {
|
class SharedDirView extends React.Component {
|
||||||
@@ -310,6 +312,7 @@ class SharedDirView extends React.Component {
|
|||||||
dragAndDrop={false}
|
dragAndDrop={false}
|
||||||
token={token}
|
token={token}
|
||||||
path={dirPath}
|
path={dirPath}
|
||||||
|
uploadUrlPath={uploadUrlPath}
|
||||||
repoID={repoID}
|
repoID={repoID}
|
||||||
onFileUploadSuccess={this.onFileUploadSuccess}
|
onFileUploadSuccess={this.onFileUploadSuccess}
|
||||||
/>
|
/>
|
||||||
|
Reference in New Issue
Block a user