From ebdfb936a351f7748a814adc845eb31e28ab4217 Mon Sep 17 00:00:00 2001 From: Barijaona Ramaholimihaso Date: Fri, 6 Sep 2024 16:13:59 +0300 Subject: [PATCH 1/3] Support "issued" tag as Atom publication date Google Mail feeds have been observed with this `issued` tag. Also change to test first the strings conforming to the official specifications. https://datatracker.ietf.org/doc/html/rfc4287 https://validator.w3.org/feed/docs/atom.html --- Vienna/Sources/Parsing/AtomFeed.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Vienna/Sources/Parsing/AtomFeed.m b/Vienna/Sources/Parsing/AtomFeed.m index c350bdcb2..046ef6188 100644 --- a/Vienna/Sources/Parsing/AtomFeed.m +++ b/Vienna/Sources/Parsing/AtomFeed.m @@ -253,7 +253,7 @@ - (BOOL)initAtomFeed:(NSXMLElement *)atomElement } // Parse item date - if (isArticleElementAtomType && ([articleItemTag isEqualToString:@"modified"] || [articleItemTag isEqualToString:@"updated"])) { + if (isArticleElementAtomType && ([articleItemTag isEqualToString:@"updated"] || [articleItemTag isEqualToString:@"modified"])) { NSString *dateString = itemChildElement.stringValue; NSDate *newDate = [self dateWithXMLString:dateString]; if (newFeedItem.modificationDate == nil || [newDate isGreaterThan:newFeedItem.modificationDate]) { @@ -263,7 +263,7 @@ - (BOOL)initAtomFeed:(NSXMLElement *)atomElement } // Parse item date - if (isArticleElementAtomType && ([articleItemTag isEqualToString:@"created"] || [articleItemTag isEqualToString:@"published"])) { + if (isArticleElementAtomType && ([articleItemTag isEqualToString:@"published"] || [articleItemTag isEqualToString:@"created"] || [articleItemTag isEqualToString:@"issued"])) { NSString *dateString = itemChildElement.stringValue; NSDate *newDate = [self dateWithXMLString:dateString]; if (newFeedItem.publicationDate == nil || [newDate isLessThan:newFeedItem.publicationDate]) { From 648eea6fe59294d87d51963bbf0780b72802c588 Mon Sep 17 00:00:00 2001 From: Barijaona Ramaholimihaso Date: Sat, 7 Sep 2024 14:42:50 +0300 Subject: [PATCH 2/3] Fix InfoWindow's feed validation on query based URLs Fix Validate button to pass correctly the feed's URL string to the validator page (https://validator.w3.org/feed/check.cgi) when the feed URL itself contains a query. Problem seen on Flickr's feeds, as well as on rss-bridge.org or YouTube feeds. Also: do not change inconsiderately the content of the URL field --- Vienna/Sources/Info panel/InfoPanelController.m | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Vienna/Sources/Info panel/InfoPanelController.m b/Vienna/Sources/Info panel/InfoPanelController.m index 8559ba405..b0808141c 100644 --- a/Vienna/Sources/Info panel/InfoPanelController.m +++ b/Vienna/Sources/Info panel/InfoPanelController.m @@ -194,14 +194,15 @@ - (IBAction)validateURL:(id)sender { NSURLComponents *urlComponents = [NSURLComponents componentsWithString:validatorURL]; NSString *validatedURL = self.urlField.stringValue.vna_trimmed; + // Override the text field's URL with the validated one. + self.urlField.stringValue = validatedURL; + NSCharacterSet *urlQuerySet = NSCharacterSet.URLQueryAllowedCharacterSet; NSString *encodedURL = [validatedURL stringByAddingPercentEncodingWithAllowedCharacters:urlQuerySet]; - - // Override the text field's URL with the encoded one. - self.urlField.stringValue = encodedURL; - + // prevent any confusion between feed's URL query string and validator's URL query string + encodedURL = [encodedURL stringByReplacingOccurrencesOfString:@"&" withString:@"%26"]; // Create the query using the encoded URL. - urlComponents.query = [NSString stringWithFormat:@"url=%@", encodedURL]; + urlComponents.percentEncodedQuery = [NSString stringWithFormat:@"url=%@", encodedURL]; if (self.delegate) { [self.delegate infoPanelControllerWillOpenURL:urlComponents.URL]; From 180a95e8dcca56d190602ede16943717f96f1554 Mon Sep 17 00:00:00 2001 From: Barijaona Ramaholimihaso Date: Sat, 7 Sep 2024 14:44:38 +0300 Subject: [PATCH 3/3] Slightly optimize some code --- Vienna/Sources/Main window/ArticleListView.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Vienna/Sources/Main window/ArticleListView.m b/Vienna/Sources/Main window/ArticleListView.m index fdc5abbc5..7dcad5928 100644 --- a/Vienna/Sources/Main window/ArticleListView.m +++ b/Vienna/Sources/Main window/ArticleListView.m @@ -938,7 +938,7 @@ -(void)scrollDownDetailsOrNextUnread [(NSView *)articleText scrollPageDown:nil]; } else { ArticleController * articleController = self.controller.articleController; - [articleController markReadByArray:articleController.markedArticleRange readFlag:YES]; + [articleController markReadByArray:self.markedArticleRange readFlag:YES]; [articleController displayNextUnread]; } }