We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see ourdocumentation.
There was an error while loading.Please reload this page.
discuss
solution
1 parentd713ad5 commit1e1d8a0Copy full SHA for 1e1d8a0
src/webview/leetCodeSolutionProvider.ts
@@ -77,10 +77,23 @@ class LeetCodeSolutionProvider extends LeetCodeWebview {
77
[solution.author,raw]=raw.match(/\*Author:\s+(.+)\n([^]+)/)!.slice(1);
78
[solution.votes,raw]=raw.match(/\*Votes:\s+(\d+)\n\n([^]+)/)!.slice(1);
79
solution.body=raw;
80
+
81
+solution.url=replaceUrlDiscussWithSolution(solution.url);
82
83
returnsolution;
84
}
85
86
87
+functionreplaceUrlDiscussWithSolution(url:string):string{
88
+// This is due to the update of leetcode.com on 2022 Dec
89
+// "vsc-leetcode-cli": "2.8.1" is still using "discuss" instead of "solutions" in URL
90
+// this will have the vsc-leetcode-cli updating URL to "solutions"
91
+returnurl.replace(
92
+/https:\/\/leetcode.com\/problems\/(.+)\/discuss\/(\d+)/,
93
+"https://discuss.leetcode.com/problem/$1/solutions/$2"
94
+);
95
+}
96
97
// tslint:disable-next-line:max-classes-per-file
98
classSolution{
99
publictitle:string="";