File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed
Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ export class Patcher {
3131 case 8 : counter += await this . patch9 ( ) ;
3232 case 9 : counter += await this . patch10 ( ) ;
3333 case 10 : counter += await this . patch11 ( ) ;
34+ case 11 : counter += await this . patch12 ( ) ;
3435 }
3536 } catch ( error ) { ErrorHandler . error ( "Patcher" , error . stack , "patch " + Patcher . version ) ; }
3637
@@ -326,4 +327,30 @@ export class Patcher {
326327 return counter ;
327328 }
328329
330+ // Patch 12: 1.5.98
331+ // TagTracker was saving tags in a URI encoded format
332+ private static async patch12 ( ) : Promise < number > {
333+ let counter = 0 ;
334+
335+ const tagTracker = await XM . Storage . getValue ( "re621.TagTracker.list" , [ ] ) ;
336+ if ( ! tagTracker || ! Array . isArray ( tagTracker ) || tagTracker . length === 0 ) {
337+ Patcher . version = 12 ;
338+ return 0 ;
339+ }
340+
341+ const decoded = [ ] ;
342+ for ( const tag of tagTracker ) {
343+ if ( / % .{ 2 } / . test ( tag ) ) {
344+ decoded . push ( decodeURIComponent ( tag ) ) ;
345+ counter ++ ;
346+ } else decoded . push ( tag ) ;
347+ }
348+
349+ if ( counter > 0 )
350+ await XM . Storage . setValue ( "re621.TagTracker.list" , [ ...new Set ( decoded ) ] ) ;
351+
352+ Patcher . version = 12 ;
353+ return counter ;
354+ }
355+
329356}
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ export class TagTracker extends SubscriptionTracker {
4242 }
4343
4444 protected fetchMinorSubscriptionName ( element : JQuery < HTMLElement > ) : string {
45- return element . attr ( "data-tag" ) ;
45+ return decodeURIComponent ( element . attr ( "data-tag" ) ) ;
4646 }
4747
4848 protected fetchMajorSubscriptionName ( element : JQuery < HTMLElement > ) : string {
You can’t perform that action at this time.
0 commit comments