Skip to content

#389: Allow period, solidus, at-sign, and percent-sign in profile names #1538

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

Merged
merged 1 commit into from
Dec 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## __AWS SDK for Java v2__
- ### Bugfixes
- The period, solidus, at-sign, and percent sign are now allowed in profile names and property names.

# __2.10.29__ __2019-12-03__
## __AWS Lambda__
- ### Features
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public final class ProfileFileReader {

private static final Pattern EMPTY_LINE = Pattern.compile("^[\t ]*$");

private static final Pattern VALID_IDENTIFIER = Pattern.compile("^[A-Za-z0-9_\\-]*$");
private static final Pattern VALID_IDENTIFIER = Pattern.compile("^[A-Za-z0-9_\\-/.%@]*$");

private ProfileFileReader() {}

Expand Down Expand Up @@ -213,7 +213,7 @@ private static Optional<String> parseProfileDefinition(ParserState state, String
// If the profile name includes invalid characters, it should be ignored.
if (!isValidIdentifier(profileName)) {
log.warn(() -> "Ignoring profile '" + standardizedProfileName + "' on line " + state.currentLineNumber + " because " +
"it was not alphanumeric with dashes or underscores.");
"it was not alphanumeric with only these special characters: - / . % @ _");
return Optional.empty();
}

Expand Down Expand Up @@ -256,7 +256,7 @@ private static Optional<Pair<String, String>> parsePropertyDefinition(ParserStat
// If the profile name includes invalid characters, it should be ignored.
if (!isValidIdentifier(propertyKey)) {
log.warn(() -> "Ignoring property '" + propertyKey + "' on line " + state.currentLineNumber + " because " +
"its name was not alphanumeric with dashes or underscores.");
"its name was not alphanumeric with only these special characters: - / . % @ _");
return Optional.empty();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,14 +326,14 @@ public void invalidPropertyNamesAreIgnored() {

@Test
public void allValidProfileNameCharactersAreSupported() {
assertThat(configFileProfiles("[profile ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_]"))
.isEqualTo(profiles(profile("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_")));
assertThat(configFileProfiles("[profile ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_./%@]"))
.isEqualTo(profiles(profile("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_./%@")));
}

@Test
public void allValidPropertyNameCharactersAreSupported() {
assertThat(configFileProfiles("[profile foo]\nABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_ = value"))
.isEqualTo(profiles(profile("foo", property("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",
assertThat(configFileProfiles("[profile foo]\nABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_./%@ = value"))
.isEqualTo(profiles(profile("foo", property("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_./%@",
"value"))));
}

Expand Down