mirror of
https://github.com/sleepypikachu/actions-branch-to-docker-tag-name.git
synced 2024-11-23 05:53:51 +08:00
Fix edge case where substring could leave trailing seperators
This commit is contained in:
parent
d316655d62
commit
aa8fa3ff4e
6
index.js
6
index.js
@ -25,13 +25,15 @@ try {
|
||||
// Remove invalid characters
|
||||
result = result.replaceAll(/[^a-zA-Z0-9\._-]/g, '')
|
||||
|
||||
// Remove start and end periods and dashes
|
||||
// Remove starting end periods and dashes
|
||||
result = result.replace(/^[-\.]+/, '')
|
||||
result = result.replace(/[-\.]+$/, '')
|
||||
|
||||
// Maximum of 128 characters
|
||||
result = result.substr(0, 128)
|
||||
|
||||
// Remove ending periods and dashes
|
||||
result = result.replace(/[-\.]+$/, '')
|
||||
|
||||
core.setOutput('tag-name', result);
|
||||
}
|
||||
} catch (error) {
|
||||
|
Loading…
Reference in New Issue
Block a user