Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
C
console
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
MyCard
console
Commits
6e22506e
Commit
6e22506e
authored
Oct 09, 2025
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reverify md5 in upload
parent
29cb3a85
Pipeline
#40954
passed with stages
in 7 minutes and 21 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
4 deletions
+15
-4
console-api/src/packager/packager.service.ts
console-api/src/packager/packager.service.ts
+7
-0
console-api/src/s3/s3.service.ts
console-api/src/s3/s3.service.ts
+8
-4
No files found.
console-api/src/packager/packager.service.ts
View file @
6e22506e
...
@@ -364,11 +364,13 @@ export class PackagerService extends ConsoleLogger {
...
@@ -364,11 +364,13 @@ export class PackagerService extends ConsoleLogger {
});
});
});
});
const
hashObject
=
createHash
(
'
sha256
'
);
const
hashObject
=
createHash
(
'
sha256
'
);
const
md5Object
=
createHash
(
'
md5
'
);
// let length = 0;
// let length = 0;
child
.
stdout
.
on
(
'
data
'
,
(
chunk
)
=>
{
child
.
stdout
.
on
(
'
data
'
,
(
chunk
)
=>
{
// length += chunk.length;
// length += chunk.length;
// this.log(`Received ${length} bytes of archive ${archiveName}.`);
// this.log(`Received ${length} bytes of archive ${archiveName}.`);
hashObject
.
update
(
chunk
);
hashObject
.
update
(
chunk
);
md5Object
.
update
(
chunk
);
});
});
const
uploadStream
=
child
.
stdout
;
const
uploadStream
=
child
.
stdout
;
...
@@ -397,6 +399,11 @@ export class PackagerService extends ConsoleLogger {
...
@@ -397,6 +399,11 @@ export class PackagerService extends ConsoleLogger {
});
});
const
[,
{
object
}]
=
await
Promise
.
all
([
childPromise
,
uploadPromise
]);
const
[,
{
object
}]
=
await
Promise
.
all
([
childPromise
,
uploadPromise
]);
archive
.
hash
=
hashObject
.
digest
(
'
hex
'
);
archive
.
hash
=
hashObject
.
digest
(
'
hex
'
);
const
md5
=
md5Object
.
digest
(
'
hex
'
);
const
md5InS3
=
await
this
.
s3
.
getObjectHash
(
archiveName
);
if
(
md5InS3
&&
md5InS3
!==
md5
)
{
throw
new
Error
(
`MD5 mismatch for archive
${
archiveName
}
: local
${
md5
}
vs s3
${
md5InS3
}
`
);
}
await
this
.
redis
.
set
(
`hash:
${
archive
.
path
}
`
,
archive
.
hash
,
'
EX
'
,
60
*
60
*
24
);
await
this
.
redis
.
set
(
`hash:
${
archive
.
path
}
`
,
archive
.
hash
,
'
EX
'
,
60
*
60
*
24
);
archive
.
size
=
object
.
Size
;
archive
.
size
=
object
.
Size
;
this
.
log
(
`Finished archiving
${
archiveName
}
.`
);
this
.
log
(
`Finished archiving
${
archiveName
}
.`
);
...
...
console-api/src/s3/s3.service.ts
View file @
6e22506e
...
@@ -73,18 +73,22 @@ export class S3Service extends ConsoleLogger {
...
@@ -73,18 +73,22 @@ export class S3Service extends ConsoleLogger {
return
this
.
s3
.
send
(
command
);
return
this
.
s3
.
send
(
command
);
}
}
async
hasObject
(
path
:
string
)
{
async
getObjectHash
(
path
:
string
)
{
try
{
try
{
await
this
.
s3
.
send
(
const
head
=
await
this
.
s3
.
send
(
new
HeadObjectCommand
({
new
HeadObjectCommand
({
Bucket
:
this
.
bucket
,
Bucket
:
this
.
bucket
,
Key
:
this
.
getPathWithPrefix
(
path
),
Key
:
this
.
getPathWithPrefix
(
path
),
})
})
);
);
return
true
;
const
etag
=
head
.
ETag
;
if
(
etag
)
{
return
etag
.
replace
(
/"/g
,
''
);
}
return
undefined
;
}
catch
(
e
)
{
}
catch
(
e
)
{
if
(
e
.
name
===
'
NotFound
'
)
{
if
(
e
.
name
===
'
NotFound
'
)
{
return
false
;
return
undefined
;
}
}
throw
e
;
// rethrow other errors
throw
e
;
// rethrow other errors
}
}
...
...
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