diff --git a/internal/cli/refresh_feeds.go b/internal/cli/refresh_feeds.go index e10600f3..d01b3ceb 100644 --- a/internal/cli/refresh_feeds.go +++ b/internal/cli/refresh_feeds.go @@ -56,11 +56,11 @@ func refreshFeeds(store *storage.Storage) { slog.Int("worker_id", workerID), ) - if err := feedHandler.RefreshFeed(store, job.UserID, job.FeedID, false); err != nil { + if localizedError := feedHandler.RefreshFeed(store, job.UserID, job.FeedID, false); err != nil { slog.Warn("Unable to refresh feed", slog.Int64("feed_id", job.FeedID), slog.Int64("user_id", job.UserID), - slog.Any("error", err), + slog.Any("error", localizedError.Error()), ) } } diff --git a/internal/locale/translations/de_DE.json b/internal/locale/translations/de_DE.json index c4d568c0..e517bb30 100644 --- a/internal/locale/translations/de_DE.json +++ b/internal/locale/translations/de_DE.json @@ -439,7 +439,7 @@ "alert.too_many_feeds_refresh": "You have triggered too many feed refreshes. Please wait 30 minutes before trying again.", "alert.background_feed_refresh": "All feeds are being refreshed in the background. You can continue to use Miniflux while this process is running.", "error.http_response_too_large": "The HTTP response is too large. You could increase the HTTP response size limit in the global settings (requires a server restart).", - "error.http_body_read": "Unable to read the HTTP body.", + "error.http_body_read": "Unable to read the HTTP body: %v.", "error.http_empty_response_body": "The HTTP response body is empty.", "error.http_empty_response": "The HTTP response is empty. Perhaps, this website is using a bot protection mechanism?", "error.tls_error": "TLS error: %v. You could disable TLS verification in the feed settings if you would like.", diff --git a/internal/locale/translations/el_EL.json b/internal/locale/translations/el_EL.json index 1bb09399..4acb9b51 100644 --- a/internal/locale/translations/el_EL.json +++ b/internal/locale/translations/el_EL.json @@ -439,7 +439,7 @@ "alert.too_many_feeds_refresh": "You have triggered too many feed refreshes. Please wait 30 minutes before trying again.", "alert.background_feed_refresh": "All feeds are being refreshed in the background. You can continue to use Miniflux while this process is running.", "error.http_response_too_large": "The HTTP response is too large. You could increase the HTTP response size limit in the global settings (requires a server restart).", - "error.http_body_read": "Unable to read the HTTP body.", + "error.http_body_read": "Unable to read the HTTP body: %v.", "error.http_empty_response_body": "The HTTP response body is empty.", "error.http_empty_response": "The HTTP response is empty. Perhaps, this website is using a bot protection mechanism?", "error.tls_error": "TLS error: %v. You could disable TLS verification in the feed settings if you would like.", diff --git a/internal/locale/translations/en_US.json b/internal/locale/translations/en_US.json index 3244adb6..4370c470 100644 --- a/internal/locale/translations/en_US.json +++ b/internal/locale/translations/en_US.json @@ -439,7 +439,7 @@ "alert.too_many_feeds_refresh": "You have triggered too many feed refreshes. Please wait 30 minutes before trying again.", "alert.background_feed_refresh": "All feeds are being refreshed in the background. You can continue to use Miniflux while this process is running.", "error.http_response_too_large": "The HTTP response is too large. You could increase the HTTP response size limit in the global settings (requires a server restart).", - "error.http_body_read": "Unable to read the HTTP body.", + "error.http_body_read": "Unable to read the HTTP body: %v.", "error.http_empty_response_body": "The HTTP response body is empty.", "error.http_empty_response": "The HTTP response is empty. Perhaps, this website is using a bot protection mechanism?", "error.tls_error": "TLS error: %v. You could disable TLS verification in the feed settings if you would like.", diff --git a/internal/locale/translations/es_ES.json b/internal/locale/translations/es_ES.json index e8bc6c2f..3aaa480e 100644 --- a/internal/locale/translations/es_ES.json +++ b/internal/locale/translations/es_ES.json @@ -439,7 +439,7 @@ "alert.too_many_feeds_refresh": "You have triggered too many feed refreshes. Please wait 30 minutes before trying again.", "alert.background_feed_refresh": "All feeds are being refreshed in the background. You can continue to use Miniflux while this process is running.", "error.http_response_too_large": "The HTTP response is too large. You could increase the HTTP response size limit in the global settings (requires a server restart).", - "error.http_body_read": "Unable to read the HTTP body.", + "error.http_body_read": "Unable to read the HTTP body: %v.", "error.http_empty_response_body": "The HTTP response body is empty.", "error.http_empty_response": "The HTTP response is empty. Perhaps, this website is using a bot protection mechanism?", "error.tls_error": "TLS error: %v. You could disable TLS verification in the feed settings if you would like.", diff --git a/internal/locale/translations/fi_FI.json b/internal/locale/translations/fi_FI.json index df3d5632..51b5b5e3 100644 --- a/internal/locale/translations/fi_FI.json +++ b/internal/locale/translations/fi_FI.json @@ -439,7 +439,7 @@ "alert.too_many_feeds_refresh": "You have triggered too many feed refreshes. Please wait 30 minutes before trying again.", "alert.background_feed_refresh": "All feeds are being refreshed in the background. You can continue to use Miniflux while this process is running.", "error.http_response_too_large": "The HTTP response is too large. You could increase the HTTP response size limit in the global settings (requires a server restart).", - "error.http_body_read": "Unable to read the HTTP body.", + "error.http_body_read": "Unable to read the HTTP body: %v.", "error.http_empty_response_body": "The HTTP response body is empty.", "error.http_empty_response": "The HTTP response is empty. Perhaps, this website is using a bot protection mechanism?", "error.tls_error": "TLS error: %v. You could disable TLS verification in the feed settings if you would like.", diff --git a/internal/locale/translations/fr_FR.json b/internal/locale/translations/fr_FR.json index dfeaa05c..7fab4d19 100644 --- a/internal/locale/translations/fr_FR.json +++ b/internal/locale/translations/fr_FR.json @@ -439,7 +439,7 @@ "alert.too_many_feeds_refresh": "Vous avez déclenché trop d'actualisations de flux. Veuillez attendre 30 minutes avant de réessayer.", "alert.background_feed_refresh": "Les abonnements sont en cours d'actualisation en arrière-plan. Vous pouvez continuer à naviguer dans l'application.", "error.http_response_too_large": "La réponse HTTP est trop volumineuse. Vous pouvez augmenter la limite de taille de réponse HTTP dans les paramètres de l'application (redémarrage de l'application nécessaire).", - "error.http_body_read": "Impossible de lire le corps de la réponse HTTP.", + "error.http_body_read": "Impossible de lire le corps de la réponse HTTP : %v.", "error.http_empty_response_body": "Le corps de la réponse HTTP est vide.", "error.http_empty_response": "La réponse HTTP est vide. Peut-être que ce site web bloque Miniflux avec une protection anti-bot ?", "error.tls_error": "Erreur TLS : %v. Vous pouvez désactiver la vérification TLS dans les paramètres de l'abonnement.", diff --git a/internal/locale/translations/hi_IN.json b/internal/locale/translations/hi_IN.json index 714976cf..616a30ee 100644 --- a/internal/locale/translations/hi_IN.json +++ b/internal/locale/translations/hi_IN.json @@ -439,7 +439,7 @@ "alert.too_many_feeds_refresh": "You have triggered too many feed refreshes. Please wait 30 minutes before trying again.", "alert.background_feed_refresh": "All feeds are being refreshed in the background. You can continue to use Miniflux while this process is running.", "error.http_response_too_large": "The HTTP response is too large. You could increase the HTTP response size limit in the global settings (requires a server restart).", - "error.http_body_read": "Unable to read the HTTP body.", + "error.http_body_read": "Unable to read the HTTP body: %v.", "error.http_empty_response_body": "The HTTP response body is empty.", "error.http_empty_response": "The HTTP response is empty. Perhaps, this website is using a bot protection mechanism?", "error.tls_error": "TLS error: %v. You could disable TLS verification in the feed settings if you would like.", diff --git a/internal/locale/translations/id_ID.json b/internal/locale/translations/id_ID.json index 25241468..0f66934b 100644 --- a/internal/locale/translations/id_ID.json +++ b/internal/locale/translations/id_ID.json @@ -430,7 +430,7 @@ "alert.too_many_feeds_refresh": "You have triggered too many feed refreshes. Please wait 30 minutes before trying again.", "alert.background_feed_refresh": "All feeds are being refreshed in the background. You can continue to use Miniflux while this process is running.", "error.http_response_too_large": "The HTTP response is too large. You could increase the HTTP response size limit in the global settings (requires a server restart).", - "error.http_body_read": "Unable to read the HTTP body.", + "error.http_body_read": "Unable to read the HTTP body: %v.", "error.http_empty_response_body": "The HTTP response body is empty.", "error.http_empty_response": "The HTTP response is empty. Perhaps, this website is using a bot protection mechanism?", "error.tls_error": "TLS error: %v. You could disable TLS verification in the feed settings if you would like.", diff --git a/internal/locale/translations/it_IT.json b/internal/locale/translations/it_IT.json index 57fed234..56fc0931 100644 --- a/internal/locale/translations/it_IT.json +++ b/internal/locale/translations/it_IT.json @@ -439,7 +439,7 @@ "alert.too_many_feeds_refresh": "You have triggered too many feed refreshes. Please wait 30 minutes before trying again.", "alert.background_feed_refresh": "All feeds are being refreshed in the background. You can continue to use Miniflux while this process is running.", "error.http_response_too_large": "The HTTP response is too large. You could increase the HTTP response size limit in the global settings (requires a server restart).", - "error.http_body_read": "Unable to read the HTTP body.", + "error.http_body_read": "Unable to read the HTTP body: %v.", "error.http_empty_response_body": "The HTTP response body is empty.", "error.http_empty_response": "The HTTP response is empty. Perhaps, this website is using a bot protection mechanism?", "error.tls_error": "TLS error: %v. You could disable TLS verification in the feed settings if you would like.", diff --git a/internal/locale/translations/ja_JP.json b/internal/locale/translations/ja_JP.json index 34463017..6690736f 100644 --- a/internal/locale/translations/ja_JP.json +++ b/internal/locale/translations/ja_JP.json @@ -439,7 +439,7 @@ "alert.too_many_feeds_refresh": "You have triggered too many feed refreshes. Please wait 30 minutes before trying again.", "alert.background_feed_refresh": "All feeds are being refreshed in the background. You can continue to use Miniflux while this process is running.", "error.http_response_too_large": "The HTTP response is too large. You could increase the HTTP response size limit in the global settings (requires a server restart).", - "error.http_body_read": "Unable to read the HTTP body.", + "error.http_body_read": "Unable to read the HTTP body: %v.", "error.http_empty_response_body": "The HTTP response body is empty.", "error.http_empty_response": "The HTTP response is empty. Perhaps, this website is using a bot protection mechanism?", "error.tls_error": "TLS error: %v. You could disable TLS verification in the feed settings if you would like.", diff --git a/internal/locale/translations/nl_NL.json b/internal/locale/translations/nl_NL.json index 0b1ed97b..f50f5023 100644 --- a/internal/locale/translations/nl_NL.json +++ b/internal/locale/translations/nl_NL.json @@ -439,7 +439,7 @@ "alert.too_many_feeds_refresh": "You have triggered too many feed refreshes. Please wait 30 minutes before trying again.", "alert.background_feed_refresh": "All feeds are being refreshed in the background. You can continue to use Miniflux while this process is running.", "error.http_response_too_large": "The HTTP response is too large. You could increase the HTTP response size limit in the global settings (requires a server restart).", - "error.http_body_read": "Unable to read the HTTP body.", + "error.http_body_read": "Unable to read the HTTP body: %v.", "error.http_empty_response_body": "The HTTP response body is empty.", "error.http_empty_response": "The HTTP response is empty. Perhaps, this website is using a bot protection mechanism?", "error.tls_error": "TLS error: %v. You could disable TLS verification in the feed settings if you would like.", diff --git a/internal/locale/translations/pl_PL.json b/internal/locale/translations/pl_PL.json index 163b23c3..22d0f164 100644 --- a/internal/locale/translations/pl_PL.json +++ b/internal/locale/translations/pl_PL.json @@ -447,7 +447,7 @@ "alert.too_many_feeds_refresh": "You have triggered too many feed refreshes. Please wait 30 minutes before trying again.", "alert.background_feed_refresh": "All feeds are being refreshed in the background. You can continue to use Miniflux while this process is running.", "error.http_response_too_large": "The HTTP response is too large. You could increase the HTTP response size limit in the global settings (requires a server restart).", - "error.http_body_read": "Unable to read the HTTP body.", + "error.http_body_read": "Unable to read the HTTP body: %v.", "error.http_empty_response_body": "The HTTP response body is empty.", "error.http_empty_response": "The HTTP response is empty. Perhaps, this website is using a bot protection mechanism?", "error.tls_error": "TLS error: %v. You could disable TLS verification in the feed settings if you would like.", diff --git a/internal/locale/translations/pt_BR.json b/internal/locale/translations/pt_BR.json index 5157509b..23856951 100644 --- a/internal/locale/translations/pt_BR.json +++ b/internal/locale/translations/pt_BR.json @@ -439,7 +439,7 @@ "alert.too_many_feeds_refresh": "You have triggered too many feed refreshes. Please wait 30 minutes before trying again.", "alert.background_feed_refresh": "All feeds are being refreshed in the background. You can continue to use Miniflux while this process is running.", "error.http_response_too_large": "The HTTP response is too large. You could increase the HTTP response size limit in the global settings (requires a server restart).", - "error.http_body_read": "Unable to read the HTTP body.", + "error.http_body_read": "Unable to read the HTTP body: %v.", "error.http_empty_response_body": "The HTTP response body is empty.", "error.http_empty_response": "The HTTP response is empty. Perhaps, this website is using a bot protection mechanism?", "error.tls_error": "TLS error: %v. You could disable TLS verification in the feed settings if you would like.", diff --git a/internal/locale/translations/ru_RU.json b/internal/locale/translations/ru_RU.json index 6575fc48..5e189afd 100644 --- a/internal/locale/translations/ru_RU.json +++ b/internal/locale/translations/ru_RU.json @@ -447,7 +447,7 @@ "alert.too_many_feeds_refresh": "You have triggered too many feed refreshes. Please wait 30 minutes before trying again.", "alert.background_feed_refresh": "All feeds are being refreshed in the background. You can continue to use Miniflux while this process is running.", "error.http_response_too_large": "The HTTP response is too large. You could increase the HTTP response size limit in the global settings (requires a server restart).", - "error.http_body_read": "Unable to read the HTTP body.", + "error.http_body_read": "Unable to read the HTTP body: %v.", "error.http_empty_response_body": "The HTTP response body is empty.", "error.http_empty_response": "The HTTP response is empty. Perhaps, this website is using a bot protection mechanism?", "error.tls_error": "TLS error: %v. You could disable TLS verification in the feed settings if you would like.", diff --git a/internal/locale/translations/tr_TR.json b/internal/locale/translations/tr_TR.json index 0a11b61b..090fa144 100644 --- a/internal/locale/translations/tr_TR.json +++ b/internal/locale/translations/tr_TR.json @@ -439,7 +439,7 @@ "alert.too_many_feeds_refresh": "You have triggered too many feed refreshes. Please wait 30 minutes before trying again.", "alert.background_feed_refresh": "All feeds are being refreshed in the background. You can continue to use Miniflux while this process is running.", "error.http_response_too_large": "The HTTP response is too large. You could increase the HTTP response size limit in the global settings (requires a server restart).", - "error.http_body_read": "Unable to read the HTTP body.", + "error.http_body_read": "Unable to read the HTTP body: %v.", "error.http_empty_response_body": "The HTTP response body is empty.", "error.http_empty_response": "The HTTP response is empty. Perhaps, this website is using a bot protection mechanism?", "error.tls_error": "TLS error: %v. You could disable TLS verification in the feed settings if you would like.", diff --git a/internal/locale/translations/uk_UA.json b/internal/locale/translations/uk_UA.json index 21b20bf5..571307ae 100644 --- a/internal/locale/translations/uk_UA.json +++ b/internal/locale/translations/uk_UA.json @@ -448,7 +448,7 @@ "alert.too_many_feeds_refresh": "You have triggered too many feed refreshes. Please wait 30 minutes before trying again.", "alert.background_feed_refresh": "All feeds are being refreshed in the background. You can continue to use Miniflux while this process is running.", "error.http_response_too_large": "The HTTP response is too large. You could increase the HTTP response size limit in the global settings (requires a server restart).", - "error.http_body_read": "Unable to read the HTTP body.", + "error.http_body_read": "Unable to read the HTTP body: %v.", "error.http_empty_response_body": "The HTTP response body is empty.", "error.http_empty_response": "The HTTP response is empty. Perhaps, this website is using a bot protection mechanism?", "error.tls_error": "TLS error: %v. You could disable TLS verification in the feed settings if you would like.", diff --git a/internal/locale/translations/zh_CN.json b/internal/locale/translations/zh_CN.json index 7b6f5663..7088e649 100644 --- a/internal/locale/translations/zh_CN.json +++ b/internal/locale/translations/zh_CN.json @@ -431,7 +431,7 @@ "alert.too_many_feeds_refresh": "You have triggered too many feed refreshes. Please wait 30 minutes before trying again.", "alert.background_feed_refresh": "All feeds are being refreshed in the background. You can continue to use Miniflux while this process is running.", "error.http_response_too_large": "The HTTP response is too large. You could increase the HTTP response size limit in the global settings (requires a server restart).", - "error.http_body_read": "Unable to read the HTTP body.", + "error.http_body_read": "Unable to read the HTTP body: %v.", "error.http_empty_response_body": "The HTTP response body is empty.", "error.http_empty_response": "The HTTP response is empty. Perhaps, this website is using a bot protection mechanism?", "error.tls_error": "TLS error: %v. You could disable TLS verification in the feed settings if you would like.", diff --git a/internal/locale/translations/zh_TW.json b/internal/locale/translations/zh_TW.json index d8d78531..33f3a2a1 100644 --- a/internal/locale/translations/zh_TW.json +++ b/internal/locale/translations/zh_TW.json @@ -439,7 +439,7 @@ "alert.too_many_feeds_refresh": "You have triggered too many feed refreshes. Please wait 30 minutes before trying again.", "alert.background_feed_refresh": "All feeds are being refreshed in the background. You can continue to use Miniflux while this process is running.", "error.http_response_too_large": "The HTTP response is too large. You could increase the HTTP response size limit in the global settings (requires a server restart).", - "error.http_body_read": "Unable to read the HTTP body.", + "error.http_body_read": "Unable to read the HTTP body: %v.", "error.http_empty_response_body": "The HTTP response body is empty.", "error.http_empty_response": "The HTTP response is empty. Perhaps, this website is using a bot protection mechanism?", "error.tls_error": "TLS error: %v. You could disable TLS verification in the feed settings if you would like.", diff --git a/internal/reader/fetcher/response_handler.go b/internal/reader/fetcher/response_handler.go index 2c00c933..4e844bae 100644 --- a/internal/reader/fetcher/response_handler.go +++ b/internal/reader/fetcher/response_handler.go @@ -78,8 +78,8 @@ func (r *ResponseHandler) ReadBody(maxBodySize int64) ([]byte, *locale.Localized buffer, err := io.ReadAll(limitedReader) if err != nil && err != io.EOF { - if err == io.ErrUnexpectedEOF { - return nil, locale.NewLocalizedErrorWrapper(fmt.Errorf("fetcher: response body too large: %w", err), "error.http_response_too_large") + if err, ok := err.(*http.MaxBytesError); ok { + return nil, locale.NewLocalizedErrorWrapper(fmt.Errorf("fetcher: response body too large: %d bytes", err.Limit), "error.http_response_too_large") } return nil, locale.NewLocalizedErrorWrapper(fmt.Errorf("fetcher: unable to read response body: %w", err), "error.http_body_read", err) diff --git a/internal/ui/feed_refresh.go b/internal/ui/feed_refresh.go index c07e082a..eb207a84 100644 --- a/internal/ui/feed_refresh.go +++ b/internal/ui/feed_refresh.go @@ -19,12 +19,12 @@ import ( func (h *handler) refreshFeed(w http.ResponseWriter, r *http.Request) { feedID := request.RouteInt64Param(r, "feedID") forceRefresh := request.QueryBoolParam(r, "forceRefresh", false) - if err := feedHandler.RefreshFeed(h.store, request.UserID(r), feedID, forceRefresh); err != nil { + if localizedError := feedHandler.RefreshFeed(h.store, request.UserID(r), feedID, forceRefresh); localizedError != nil { slog.Warn("Unable to refresh feed", slog.Int64("user_id", request.UserID(r)), slog.Int64("feed_id", feedID), slog.Bool("force_refresh", forceRefresh), - slog.Any("error", err), + slog.Any("error", localizedError.Error()), ) }