mirror of https://github.com/actions/toolkit
re-add noop logs and format + lint
parent
4256ea99c5
commit
ac84a9bee3
|
@ -13,7 +13,7 @@ import {
|
||||||
streamExtractExternal
|
streamExtractExternal
|
||||||
} from '../src/internal/download/download-artifact'
|
} from '../src/internal/download/download-artifact'
|
||||||
import {getUserAgentString} from '../src/internal/shared/user-agent'
|
import {getUserAgentString} from '../src/internal/shared/user-agent'
|
||||||
//import {noopLogs} from './common'
|
import {noopLogs} from './common'
|
||||||
import * as config from '../src/internal/shared/config'
|
import * as config from '../src/internal/shared/config'
|
||||||
import {ArtifactServiceClientJSON} from '../src/generated'
|
import {ArtifactServiceClientJSON} from '../src/generated'
|
||||||
import * as util from '../src/internal/shared/util'
|
import * as util from '../src/internal/shared/util'
|
||||||
|
@ -88,7 +88,7 @@ const expectExtractedArchive = async (dir: string): Promise<void> => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const setup = async (): Promise<void> => {
|
const setup = async (): Promise<void> => {
|
||||||
//noopLogs()
|
noopLogs()
|
||||||
await fs.promises.mkdir(testDir, {recursive: true})
|
await fs.promises.mkdir(testDir, {recursive: true})
|
||||||
await createTestArchive()
|
await createTestArchive()
|
||||||
|
|
||||||
|
@ -200,12 +200,14 @@ describe('download-artifact', () => {
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
await expect(downloadArtifactPublic(
|
await expect(
|
||||||
|
downloadArtifactPublic(
|
||||||
fixtures.artifactID,
|
fixtures.artifactID,
|
||||||
fixtures.repositoryOwner,
|
fixtures.repositoryOwner,
|
||||||
fixtures.repositoryName,
|
fixtures.repositoryName,
|
||||||
fixtures.token
|
fixtures.token
|
||||||
)).rejects.toBeInstanceOf(Error)
|
)
|
||||||
|
).rejects.toBeInstanceOf(Error)
|
||||||
|
|
||||||
expect(downloadArtifactMock).toHaveBeenCalledWith({
|
expect(downloadArtifactMock).toHaveBeenCalledWith({
|
||||||
owner: fixtures.repositoryOwner,
|
owner: fixtures.repositoryOwner,
|
||||||
|
|
|
@ -47,7 +47,9 @@ async function streamExtract(url: string, directory: string): Promise<void> {
|
||||||
return
|
return
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error.message.includes('Malformed extraction path')) {
|
if (error.message.includes('Malformed extraction path')) {
|
||||||
throw new Error(`Artifact download failed with unretryable error: ${error.message}`)
|
throw new Error(
|
||||||
|
`Artifact download failed with unretryable error: ${error.message}`
|
||||||
|
)
|
||||||
}
|
}
|
||||||
retryCount++
|
retryCount++
|
||||||
core.debug(
|
core.debug(
|
||||||
|
@ -99,7 +101,7 @@ export async function streamExtractExternal(
|
||||||
.pipe(unzip.Parse())
|
.pipe(unzip.Parse())
|
||||||
.on('entry', (entry: unzip.Entry) => {
|
.on('entry', (entry: unzip.Entry) => {
|
||||||
const fullPath = path.normalize(path.join(directory, entry.path))
|
const fullPath = path.normalize(path.join(directory, entry.path))
|
||||||
if (fullPath.indexOf(directory) !== 0) {
|
if (!fullPath.startsWith(directory)) {
|
||||||
reject(new Error(`Malformed extraction path: ${fullPath}`))
|
reject(new Error(`Malformed extraction path: ${fullPath}`))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue