File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1250,9 +1250,12 @@ export class SubmissionService {
12501250 const trimmed = name . trim ( ) ;
12511251 if ( ! trimmed ) return undefined ;
12521252 const base = basename ( trimmed ) ;
1253- const sanitized = base
1254- . replace ( / [ ^ A - Z a - z 0 - 9 _ . - ] / g, '_' )
1255- . replace ( / \. + $ / g, '' ) ;
1253+ let sanitized = base . replace ( / [ ^ A - Z a - z 0 - 9 _ . - ] / g, '_' ) ;
1254+ let end = sanitized . length ;
1255+ while ( end > 0 && sanitized . charCodeAt ( end - 1 ) === 46 ) {
1256+ end -= 1 ;
1257+ }
1258+ sanitized = end === sanitized . length ? sanitized : sanitized . slice ( 0 , end ) ;
12561259 if ( ! sanitized || sanitized === '.' || sanitized === '..' ) {
12571260 return undefined ;
12581261 }
@@ -1654,17 +1657,15 @@ export class SubmissionService {
16541657 try {
16551658 const urlObj = new URL ( body . url ) ;
16561659 // Accept s3.amazonaws.com and any subdomain of s3.amazonaws.com
1657- const s3Hosts = [
1658- 's3.amazonaws.com' ,
1659- ] ;
1660+ const s3Hosts = [ 's3.amazonaws.com' ] ;
16601661 // Accept region pattern: *.s3.amazonaws.com or *.s3.<region>.amazonaws.com
16611662 const host = urlObj . host ;
16621663 hasS3Url =
16631664 s3Hosts . includes ( host ) ||
16641665 host . endsWith ( '.s3.amazonaws.com' ) ||
16651666 / ^ s 3 \. [ a - z 0 - 9 - ] + \. a m a z o n a w s \. c o m $ / . test ( host ) ||
1666- / ^ [ ^ \ .] + \. s 3 \. [ a - z 0 - 9 - ] + \. a m a z o n a w s \. c o m $ / . test ( host ) ;
1667- } catch ( e ) {
1667+ / ^ [ ^ . ] + \. s 3 \. [ a - z 0 - 9 - ] + \. a m a z o n a w s \. c o m $ / . test ( host ) ;
1668+ } catch {
16681669 hasS3Url = false ;
16691670 }
16701671 }
You can’t perform that action at this time.
0 commit comments