File tree Expand file tree Collapse file tree 4 files changed +5
-6
lines changed
apps/contract-verification/src/app/Verifiers Expand file tree Collapse file tree 4 files changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -38,11 +38,11 @@ export class BlockscoutVerifier extends EtherscanVerifier {
3838 const result : SourceFile [ ] = [ ]
3939 const filePrefix = `/${ this . LOOKUP_STORE_DIR } /${ chainId } /${ contractAddress } `
4040
41- const targetFilePath = `${ filePrefix } /${ blockscoutSource . FileName } `
41+ const targetFilePath = `${ filePrefix } /${ blockscoutSource . FileName . startsWith ( '..' ) ? blockscoutSource . FileName . replace ( '../' , '' ) : blockscoutSource . FileName } `
4242 result . push ( { content : blockscoutSource . SourceCode , path : targetFilePath } )
4343
4444 for ( const additional of blockscoutSource . AdditionalSources ?? [ ] ) {
45- result . push ( { content : additional . SourceCode , path : `${ filePrefix } /${ additional . Filename } ` } )
45+ if ( ! additional . Filename . startsWith ( '..' ) ) result . push ( { content : additional . SourceCode , path : `${ filePrefix } /${ additional . Filename } ` } )
4646 }
4747
4848 return { sourceFiles : result , targetFilePath }
Original file line number Diff line number Diff line change @@ -273,11 +273,11 @@ export class EtherscanVerifier extends AbstractVerifier {
273273 parsedFiles = JSON . parse ( source . SourceCode . substring ( 1 , source . SourceCode . length - 1 ) ) . sources
274274 } catch ( e ) { }
275275 }
276-
277276 if ( parsedFiles ) {
278277 const result : SourceFile [ ] = [ ]
279278 let targetFilePath = ''
280279 for ( const [ fileName , fileObj ] of Object . entries < any > ( parsedFiles ) ) {
280+ if ( fileName . startsWith ( '..' ) ) continue
281281 const path = `${ filePrefix } /${ fileName } `
282282
283283 result . push ( { path, content : fileObj . content } )
@@ -288,7 +288,6 @@ export class EtherscanVerifier extends AbstractVerifier {
288288 }
289289 return { sourceFiles : result , targetFilePath }
290290 }
291-
292291 // Parsing to JSON failed, SourceCode is the code itself
293292 const targetFilePath = `${ filePrefix } /${ source . ContractName } .sol`
294293 const sourceFiles : SourceFile [ ] = [ { content : source . SourceCode , path : targetFilePath } ]
Original file line number Diff line number Diff line change @@ -152,7 +152,7 @@ export class SourcifyV1Verifier extends AbstractVerifier {
152152 }
153153 }
154154
155- if ( filePath ) {
155+ if ( filePath && ! filePath . startsWith ( '..' ) ) {
156156 result . push ( { path : `${ filePrefix } /${ filePath } ` , content : file . content } )
157157 }
158158
Original file line number Diff line number Diff line change @@ -212,8 +212,8 @@ export class SourcifyVerifier extends AbstractVerifier {
212212 // Extract contract path from fully qualified name (path can include colons)
213213 const splitIdentifier = fullyQualifiedName . split ( ':' )
214214 const contractPath = splitIdentifier . slice ( 0 , - 1 ) . join ( ':' )
215-
216215 for ( const [ filePath , fileData ] of Object . entries ( sources ) ) {
216+ if ( filePath . startsWith ( '..' ) ) continue
217217 const path = `${ filePrefix } /sources/${ filePath } `
218218 result . push ( { path, content : fileData . content } )
219219 if ( filePath === contractPath ) {
You can’t perform that action at this time.
0 commit comments