Browse Source

multipart upload

tags/v1.22.2.1
lewis 3 years ago
parent
commit
e6855a4d63
3 changed files with 4 additions and 5 deletions
  1. +2
    -2
      modules/storage/obs.go
  2. +1
    -1
      routers/repo/attachment.go
  3. +1
    -2
      web_src/js/components/ObsUploader.vue

+ 2
- 2
modules/storage/obs.go View File

@@ -57,8 +57,8 @@ func ObsHasObject(path string) (bool, error) {
return hasObject, nil return hasObject, nil
} }


func GetObsPartInfos(uuid string, uploadID string) (string, error) {
key := strings.TrimPrefix(path.Join(setting.BasePath, path.Join(uuid[0:1], uuid[1:2], uuid, uuid)), "/")
func GetObsPartInfos(uuid, uploadID, fileName string) (string, error) {
key := strings.TrimPrefix(path.Join(setting.BasePath, path.Join(uuid[0:1], uuid[1:2], uuid, fileName)), "/")


output, err := ObsCli.ListParts(&obs.ListPartsInput{ output, err := ObsCli.ListParts(&obs.ListPartsInput{
Bucket: setting.Bucket, Bucket: setting.Bucket,


+ 1
- 1
routers/repo/attachment.go View File

@@ -542,7 +542,7 @@ func GetSuccessChunks(ctx *context.Context) {
log.Error("GetPartInfos failed:%v", err.Error()) log.Error("GetPartInfos failed:%v", err.Error())
} }
} else { } else {
chunks, err = storage.GetObsPartInfos(fileChunk.UUID, fileChunk.UploadID)
chunks, err = storage.GetObsPartInfos(fileChunk.UUID, fileChunk.UploadID, fileName)
if err != nil { if err != nil {
log.Error("GetObsPartInfos failed:%v", err.Error()) log.Error("GetObsPartInfos failed:%v", err.Error())
} }


+ 1
- 2
web_src/js/components/ObsUploader.vue View File

@@ -355,10 +355,9 @@ export default {
xhr.open('PUT', url, false); xhr.open('PUT', url, false);
xhr.setRequestHeader('Content-Type', '') xhr.setRequestHeader('Content-Type', '')
xhr.send(e.target.result); xhr.send(e.target.result);
var etagValue = xhr.getResponseHeader('etag');
var etagValue = xhr.getResponseHeader('ETag');
//console.log(etagValue); //console.log(etagValue);
etags[currentChunk] = etagValue; etags[currentChunk] = etagValue;
console.log(etagValue)
} }


async function updateChunk(currentChunk) { async function updateChunk(currentChunk) {


Loading…
Cancel
Save