File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -77,10 +77,23 @@ class LeetCodeSolutionProvider extends LeetCodeWebview {
7777 [ solution . author , raw ] = raw . match ( / \* A u t h o r : \s + ( .+ ) \n ( [ ^ ] + ) / ) ! . slice ( 1 ) ;
7878 [ solution . votes , raw ] = raw . match ( / \* V o t e s : \s + ( \d + ) \n \n ( [ ^ ] + ) / ) ! . slice ( 1 ) ;
7979 solution . body = raw ;
80+
81+ solution . url = replaceUrlDiscussWithSolution ( solution . url ) ;
82+
8083 return solution ;
8184 }
8285}
8386
87+ function replaceUrlDiscussWithSolution ( 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+ return url . replace (
92+ / h t t p s : \/ \/ l e e t c o d e .c o m \/ p r o b l e m s \/ ( .+ ) \/ d i s c u s s \/ ( \d + ) / ,
93+ "https://discuss.leetcode.com/problem/$1/solutions/$2"
94+ ) ;
95+ }
96+
8497// tslint:disable-next-line:max-classes-per-file
8598class Solution {
8699 public title : string = "" ;
You can’t perform that action at this time.
0 commit comments