Skip to content
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

feat: uri encode processing for attachment paths when querying attachments #1874

Merged
merged 7 commits into from
May 17, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ public Builder setNameSuffix(String nameSuffix) {
}

String buildName() {
this.name = this.name.replace("%", "‰").replace("#", "井");
StringBuilder sb = new StringBuilder()
.append(this.name);
if (shouldRename()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,15 @@ public void otherName() {
assertEquals("2021/10/1.4.9.png", descriptor.getRelativePath());
}

@Test
public void nameWithIllegalChar() {
JohnNiang marked this conversation as resolved.
Show resolved Hide resolved
FilePathDescriptor descriptor = descriptorBuilder.setOriginalName("1%-1#101.png").build();
assertEquals("1‰-1井101", descriptor.getName());
assertEquals("1‰-1井101.png", descriptor.getFullName());
assertEquals("/home/halo/2021/10/1‰-1井101.png", descriptor.getFullPath());
assertEquals("2021/10/1‰-1井101.png", descriptor.getRelativePath());
}

@Test
public void windowsSystem() {
FilePathDescriptor descriptor = new FilePathDescriptor.Builder()
Expand Down