Skip to content

Commit

Permalink
fix: improve time format validation in text parsing logic
Browse files Browse the repository at this point in the history
chore: bump version to 0.6.2
  • Loading branch information
castdrian committed Dec 24, 2024
1 parent 0107f3f commit e0433c9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
15 changes: 12 additions & 3 deletions Tweak.x
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,18 @@
NSString *text = [attributedText string];
if (text && [text containsString:@" · "]) {
NSArray *components = [text componentsSeparatedByString:@" · "];
if (components.count >= 1 && ![components[0] containsString:@":"]) {
completion(components[0]);
return;
if (components.count >= 1) {
NSString *firstComponent = components[0];
NSRegularExpression *timeRegex = [NSRegularExpression
regularExpressionWithPattern:@"^\\d{1,2}:\\d{2}$"
options:0
error:nil];

NSRange range = NSMakeRange(0, firstComponent.length);
if ([timeRegex numberOfMatchesInString:firstComponent options:0 range:range] == 0) {
completion(firstComponent);
return;
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion control
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: dev.adrian.gonerino
Name: Gonerino
Version: 0.6.1
Version: 0.6.2
Architecture: iphoneos-arm
Description: Remove videos uploaded by specific channels
Maintainer: Adrian Castro
Expand Down

0 comments on commit e0433c9

Please sign in to comment.