Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
CloWM UI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Monitor
Service Desk
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Computational Metagenomics
CloWM
CloWM UI
Commits
dc2060fa
Verified
Commit
dc2060fa
authored
11 months ago
by
Daniel Göbel
Browse files
Options
Downloads
Patches
Plain Diff
Abort a multipart upload if it fails
#113
parent
b48cfd7d
No related branches found
No related tags found
1 merge request
!110
Resolve "List Multipart Uploads and abort them"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/stores/s3objects.ts
+18
-1
18 additions, 1 deletion
src/stores/s3objects.ts
with
18 additions
and
1 deletion
src/stores/s3objects.ts
+
18
−
1
View file @
dc2060fa
import
{
defineStore
}
from
"
pinia
"
;
import
{
defineStore
}
from
"
pinia
"
;
import
type
{
_Object
as
S3Object
,
HeadObjectOutput
}
from
"
@aws-sdk/client-s3
"
;
import
type
{
_Object
as
S3Object
,
HeadObjectOutput
}
from
"
@aws-sdk/client-s3
"
;
import
{
import
{
AbortMultipartUploadCommand
,
CopyObjectCommand
,
CopyObjectCommand
,
GetObjectCommand
,
GetObjectCommand
,
HeadObjectCommand
,
HeadObjectCommand
,
...
@@ -237,7 +238,23 @@ export const useS3ObjectStore = defineStore({
...
@@ -237,7 +238,23 @@ export const useS3ObjectStore = defineStore({
if
(
onProgress
!=
undefined
)
{
if
(
onProgress
!=
undefined
)
{
parallelUploads3
.
on
(
"
httpUploadProgress
"
,
onProgress
);
parallelUploads3
.
on
(
"
httpUploadProgress
"
,
onProgress
);
}
}
await
parallelUploads3
.
done
();
try
{
await
parallelUploads3
.
done
();
}
catch
(
e
)
{
// if there is an error with the multipart upload, send an abort multipart upload command
const
uploadObject
=
JSON
.
parse
(
JSON
.
stringify
(
parallelUploads3
));
if
(
uploadObject
[
"
isMultiPart
"
]
&&
uploadObject
[
"
uploadId
"
])
{
await
this
.
client
.
send
(
new
AbortMultipartUploadCommand
({
// AbortMultipartUploadRequest
Bucket
:
bucketName
,
// required
Key
:
key
,
// required
UploadId
:
uploadObject
[
"
uploadId
"
],
// required
}),
);
}
throw
e
;
}
const
newObj
=
{
const
newObj
=
{
Key
:
key
,
Key
:
key
,
Size
:
file
.
size
??
0
,
Size
:
file
.
size
??
0
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment