Skip to content

Commit d308ce8

Browse files
authored
Fix redirect to original for alternative StackOverflow domains (#1044)
1 parent f9b2631 commit d308ce8

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/assets/javascripts/services.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -816,7 +816,13 @@ async function reverse(url) {
816816
}
817817
if (url.pathname.startsWith("/exchange/")) {
818818
const regex = /\/exchange\/(.*?)(\/.*)/.exec(url.pathname)
819-
if (regex) return `https://${regex[1]}.stackexchange.com${regex[2]}`
819+
if (regex) {
820+
if (regex[1].includes(".")) {
821+
return `https://${regex[1]}${regex[2]}`
822+
} else {
823+
return `https://${regex[1]}.stackexchange.com${regex[2]}`
824+
}
825+
}
820826
}
821827
return
822828
}

0 commit comments

Comments
 (0)