Skip to content

Commit 3b354c0

Browse files
committed
[OPG] Add prefix "-" to shortener
1 parent c89768b commit 3b354c0

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

next.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const rewrites = async () => {
1919
destination: '/feature/:coords',
2020
},
2121
{
22-
source: '/:shortener([A-Za-z0-9]+[nwr])',
22+
source: '/:shortener(\-[A-Za-z0-9]+[nwr])',
2323
destination: '/feature/:shortener',
2424
},
2525
{

src/services/helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export const getFullOsmappLink = (feature: Feature) =>
3434

3535
export const getShortLink = (feature: Feature) => {
3636
const slug = getShortenerSlug(feature.osmMeta);
37-
return slug === null ? null : `${PROJECT_URL}/${slug}`;
37+
return slug === null ? null : `${PROJECT_URL}/-${slug}`;
3838
};
3939

4040
export const prod = process.env.NODE_ENV === 'production';

src/services/shortener.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export const getShortenerSlug = ({ id, type }: OsmId): string | null => {
5757
export const getIdFromShortener = (slug: string): OsmId | null => {
5858
const typeChar = slug.substr(-1, 1);
5959
const type = LOOKUP[typeChar];
60-
const encoded = slug.substring(0, slug.length - 1);
60+
const encoded = slug.substring(1, slug.length - 1);
6161

6262
if (!type) {
6363
return null;

0 commit comments

Comments
 (0)