-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Fix artifact staging filenames on Windows #39363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -166,6 +166,27 @@ public void testStageArtifacts() throws InterruptedException, ExecutionException | |
| checkArtifacts(contentsList, staged.get("env2")); | ||
| } | ||
|
|
||
| @Test | ||
| public void testStageArtifactsWithInvalidFilenameCharacters() | ||
| throws InterruptedException, ExecutionException { | ||
| String environment = "0:ref_Environment_default"; | ||
| List<String> contentsList = ImmutableList.of("artifact-content"); | ||
|
|
||
| stagingService.registerJob( | ||
| "stagingToken", | ||
| ImmutableMap.of( | ||
| environment, | ||
| Lists.transform(contentsList, FakeArtifactRetrievalService::resolvedArtifact))); | ||
|
|
||
| ArtifactStagingService.offer(new FakeArtifactRetrievalService(), stagingStub, "stagingToken"); | ||
|
|
||
| Map<String, List<RunnerApi.ArtifactInformation>> staged = | ||
| stagingService.getStagedArtifacts("stagingToken"); | ||
|
|
||
| assertEquals(1, staged.size()); | ||
| checkArtifacts(contentsList, staged.get(environment)); | ||
|
Comment on lines
+186
to
+187
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since |
||
| } | ||
|
|
||
| private void checkArtifacts( | ||
| List<String> expectedContents, List<RunnerApi.ArtifactInformation> staged) { | ||
| assertEquals( | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To avoid compiling the regular expression pattern on every invocation of
createFilename, it is highly recommended to precompile the pattern as aprivate static final Patternconstant at the class level.For example: