mirror of
https://github.com/filebrowser/filebrowser.git
synced 2025-07-15 04:20:26 +00:00
fix: invalid path when uploading files
This commit is contained in:
parent
e6ffb65374
commit
9072cbce34
@ -1,5 +1,5 @@
|
|||||||
import * as tus from "tus-js-client";
|
import * as tus from "tus-js-client";
|
||||||
import { baseURL, tusEndpoint, tusSettings } from "@/utils/constants";
|
import { baseURL, tusEndpoint, tusSettings, origin } from "@/utils/constants";
|
||||||
import { useAuthStore } from "@/stores/auth";
|
import { useAuthStore } from "@/stores/auth";
|
||||||
import { useUploadStore } from "@/stores/upload";
|
import { useUploadStore } from "@/stores/upload";
|
||||||
import { removePrefix } from "@/api/utils";
|
import { removePrefix } from "@/api/utils";
|
||||||
@ -35,7 +35,7 @@ export async function upload(
|
|||||||
}
|
}
|
||||||
return new Promise<void | string>((resolve, reject) => {
|
return new Promise<void | string>((resolve, reject) => {
|
||||||
const upload = new tus.Upload(content, {
|
const upload = new tus.Upload(content, {
|
||||||
endpoint: `${baseURL}${resourcePath}`,
|
endpoint: `${origin}${baseURL}${resourcePath}`,
|
||||||
chunkSize: tusSettings.chunkSize,
|
chunkSize: tusSettings.chunkSize,
|
||||||
retryDelays: computeRetryDelays(tusSettings),
|
retryDelays: computeRetryDelays(tusSettings),
|
||||||
parallelUploads: 1,
|
parallelUploads: 1,
|
||||||
|
@ -147,7 +147,8 @@ func tusPostHandler() handleFunc {
|
|||||||
// Enables the user to utilize the PATCH endpoint for uploading file data
|
// Enables the user to utilize the PATCH endpoint for uploading file data
|
||||||
registerUpload(file.RealPath(), uploadLength)
|
registerUpload(file.RealPath(), uploadLength)
|
||||||
|
|
||||||
w.Header().Set("Location", "/api/tus/"+r.URL.Path)
|
// Signal the frontend to reuse the current request URL
|
||||||
|
w.Header().Set("Location", "")
|
||||||
|
|
||||||
return http.StatusCreated, nil
|
return http.StatusCreated, nil
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user