mirror of
https://github.com/goreleaser/goreleaser-action
synced 2026-07-08 13:57:31 +00:00
Remove absolute paths
This commit is contained in:
+6
-7
@@ -10,13 +10,11 @@ const MAX_FILENAME_LENGTH = 100;
|
||||
const reControlChars = /[\u0000-\u001f\u0080-\u009f]/g; // eslint-disable-line no-control-regex
|
||||
const reRelativePath = /^\.+/;
|
||||
|
||||
const fn = (string, options) => {
|
||||
const filenamify = (string, options = {}) => {
|
||||
if (typeof string !== 'string') {
|
||||
throw new TypeError('Expected a string');
|
||||
}
|
||||
|
||||
options = options || {};
|
||||
|
||||
const replacement = options.replacement === undefined ? '!' : options.replacement;
|
||||
|
||||
if (filenameReservedRegex().test(replacement) && reControlChars.test(replacement)) {
|
||||
@@ -38,9 +36,10 @@ const fn = (string, options) => {
|
||||
return string;
|
||||
};
|
||||
|
||||
fn.path = (pth, options) => {
|
||||
pth = path.resolve(pth);
|
||||
return path.join(path.dirname(pth), fn(path.basename(pth), options));
|
||||
filenamify.path = (filePath, options) => {
|
||||
filePath = path.resolve(filePath);
|
||||
return path.join(path.dirname(filePath), filenamify(path.basename(filePath), options));
|
||||
};
|
||||
|
||||
module.exports = fn;
|
||||
module.exports = filenamify;
|
||||
module.exports.default = filenamify;
|
||||
|
||||
Reference in New Issue
Block a user