mirror of
https://github.com/actions/download-artifact.git
synced 2025-07-27 00:48:28 +02:00
Only replace tilde in certain scenarios
This commit is contained in:
parent
0bc4c5f195
commit
23faf7dc6f
2 changed files with 14 additions and 5 deletions
9
dist/index.js
vendored
9
dist/index.js
vendored
|
@ -6642,8 +6642,13 @@ function run() {
|
||||||
try {
|
try {
|
||||||
const name = core.getInput(constants_1.Inputs.Name, { required: false });
|
const name = core.getInput(constants_1.Inputs.Name, { required: false });
|
||||||
const path = core.getInput(constants_1.Inputs.Path, { required: false });
|
const path = core.getInput(constants_1.Inputs.Path, { required: false });
|
||||||
// resolve tilde expansion
|
let resolvedPath;
|
||||||
const resolvedPath = path_1.resolve(path.replace('~', os.homedir));
|
if (path === '~' || path.startsWith(`~${path_1.sep}`)) {
|
||||||
|
resolvedPath = path_1.resolve(path.replace('~', os.homedir()));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
resolvedPath = path_1.resolve(path);
|
||||||
|
}
|
||||||
core.debug(`Resolved path is ${resolvedPath}`);
|
core.debug(`Resolved path is ${resolvedPath}`);
|
||||||
const artifactClient = artifact.create();
|
const artifactClient = artifact.create();
|
||||||
if (!name) {
|
if (!name) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import * as core from '@actions/core'
|
import * as core from '@actions/core'
|
||||||
import * as artifact from '@actions/artifact'
|
import * as artifact from '@actions/artifact'
|
||||||
import * as os from 'os'
|
import * as os from 'os'
|
||||||
import {resolve} from 'path'
|
import {resolve, sep} from 'path'
|
||||||
import {Inputs, Outputs} from './constants'
|
import {Inputs, Outputs} from './constants'
|
||||||
|
|
||||||
async function run(): Promise<void> {
|
async function run(): Promise<void> {
|
||||||
|
@ -9,8 +9,12 @@ async function run(): Promise<void> {
|
||||||
const name = core.getInput(Inputs.Name, {required: false})
|
const name = core.getInput(Inputs.Name, {required: false})
|
||||||
const path = core.getInput(Inputs.Path, {required: false})
|
const path = core.getInput(Inputs.Path, {required: false})
|
||||||
|
|
||||||
// resolve tilde expansion
|
let resolvedPath
|
||||||
const resolvedPath = resolve(path.replace('~', os.homedir))
|
if (path === '~' || path.startsWith(`~${sep}`)) {
|
||||||
|
resolvedPath = resolve(path.replace('~', os.homedir()))
|
||||||
|
} else {
|
||||||
|
resolvedPath = resolve(path)
|
||||||
|
}
|
||||||
core.debug(`Resolved path is ${resolvedPath}`)
|
core.debug(`Resolved path is ${resolvedPath}`)
|
||||||
|
|
||||||
const artifactClient = artifact.create()
|
const artifactClient = artifact.create()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue