Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
C
Console Mirror Middleware
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
Console Mirror Middleware
Commits
9fd5bb06
Commit
9fd5bb06
authored
Oct 26, 2022
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
logging
parent
66d14f36
Pipeline
#17468
passed with stages
in 2 minutes and 25 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
+9
-2
src/one-two-three/one-two-three.service.ts
src/one-two-three/one-two-three.service.ts
+9
-2
No files found.
src/one-two-three/one-two-three.service.ts
View file @
9fd5bb06
...
...
@@ -134,6 +134,7 @@ export class OneTwoThreeService extends MiddlewareService {
async
upload
(
info
)
{
try
{
const
fileName
=
info
.
getFilename
();
this
.
log
(
`Uploading
${
info
.
url
}
as
${
fileName
}
`
);
const
uploadReq
=
await
lastValueFrom
(
this
.
http
.
post
<
OTTResponse
<
UploadReq
>>
(
'
https://www.123pan.com/api/file/upload_request
'
,
...
...
@@ -161,9 +162,11 @@ export class OneTwoThreeService extends MiddlewareService {
if
(
!
uploadReq
.
data
.
data
.
AccessKeyId
)
{
// already uploaded
// return JSON.stringify(adaptFileInfo(uploadReq.data.data.Info));
return
await
this
.
getDownloadUrl
(
const
existing
=
await
this
.
getDownloadUrl
(
adaptFileInfo
(
uploadReq
.
data
.
data
.
Info
),
);
this
.
log
(
`File
${
fileName
}
exists as
${
existing
}
, skipping.`
);
return
existing
;
}
const
s3
=
new
S3Client
({
...
...
@@ -200,7 +203,11 @@ export class OneTwoThreeService extends MiddlewareService {
},
),
);
return
await
this
.
getDownloadUrl
(
adaptFileInfo
(
uploadReq
.
data
.
data
.
Info
));
const
uploadedUrl
=
await
this
.
getDownloadUrl
(
adaptFileInfo
(
completeReq
.
data
.
data
.
Info
),
);
this
.
log
(
`Uploaded
${
fileName
}
as
${
uploadedUrl
}
`
);
return
uploadedUrl
;
}
catch
(
e
)
{
this
.
error
(
`Upload failed:
${
e
.
message
}
`
);
throw
new
BlankReturnMessageDto
(
500
,
e
.
message
).
toException
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment