Skip to content

Commit 593e754

Browse files
committed
fix: correctly expand catalog numbers when a string starts with numbers
Fix #1518
1 parent e60e9ed commit 593e754

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

src/main/frontend/src/utils/CatalogUtils.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ var CatalogUtils = {
1515
return input;
1616
}
1717

18-
if (! /^\s*[0-9]+[-\/][0-9]+(,[ ]*[0-9]+([-\/][0-9]+)?)*\s*$/.test(input)) {
18+
if (! /^(\s*[0-9]+,)*\s*[0-9]+[-\/][0-9]+(,[ ]*[0-9]+([-\/][0-9]+)?)*\s*$/.test(input)) {
1919
return input;
2020
}
2121

src/main/frontend/src/utils/CatalogUtils.test.js

+8
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,14 @@ describe("CatalogUtils.expandNumbers()", function() {
6262
expect(CatalogUtils.expandNumbers("1-3,5-6,8-9")).toEqual("1,2,3,5,6,8,9");
6363
});
6464

65+
it("should return '989,1166,1167' for '989,1166-1167'", function() {
66+
expect(CatalogUtils.expandNumbers("989,1166-1167")).toEqual("989,1166,1167");
67+
});
68+
69+
it("should return '989,1166,1167' for '989,1166-1167'", function() {
70+
expect(CatalogUtils.expandNumbers(" 989,1166-1167")).toEqual("989,1166,1167");
71+
});
72+
6573
it("should return 'test 1-3' for 'test 1-3'", function() {
6674
expect(CatalogUtils.expandNumbers("test 1-3")).toEqual("test 1-3");
6775
});

src/main/java/ru/mystamps/web/feature/site/ResourceUrl.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public final class ResourceUrl {
3232
public static final String STATIC_RESOURCES_URL = "https://stamps.filezz.ru";
3333

3434
// MUST be updated when any of our resources were modified
35-
public static final String RESOURCES_VERSION = "v0.4.6.0";
35+
public static final String RESOURCES_VERSION = "v0.4.6.1";
3636

3737
// CheckStyle: ignore LineLength for next 17 lines
3838
private static final String CATALOG_UTILS_JS = "/public/js/" + RESOURCES_VERSION + "/utils/CatalogUtils.min.js";

0 commit comments

Comments
 (0)