Skip to content

Commit 0ee1b3a

Browse files
committed
Fix: Bad docker image name prefix pruning
If a workspace name started with _ or ., the generated docker image name segment would be invalid due to `-_` or `-.` sequences, this code simply extends the postfix pruning code to also prune these prefixes
1 parent 51f46f2 commit 0ee1b3a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/docker/custom.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,13 @@ fn docker_tag_name(file_name: &str) -> String {
266266

267267
// in case our result ends in an invalid last char `-` or `.`
268268
// we remove
269-
result = result.trim_end_matches(&['.', '-']).to_owned();
269+
// in case our result starts in a `_`, we trim it
270+
// as this otherwise clashes with the `-` prefix, leading to
271+
// the invalid sequence `-_`
272+
result = result
273+
.trim_end_matches(['.', '-'])
274+
.trim_start_matches(['.', '_'])
275+
.to_owned();
270276

271277
// in case all characters were invalid or we had all non-ASCII
272278
// characters followed by a `-` or `.`, we use a non-empty filename

0 commit comments

Comments
 (0)