Просмотр исходного кода

fix(api): rewrite entry content URLs with media proxy in fetchContent endpoint

Jiacheng 7 месяцев назад
Родитель
Сommit
b3a63dbd86
1 измененных файлов с 1 добавлено и 5 удалено
  1. 1 5
      internal/api/entry.go

+ 1 - 5
internal/api/entry.go

@@ -341,13 +341,9 @@ func (h *handler) fetchContent(w http.ResponseWriter, r *http.Request) {
 			json.ServerError(w, r, err)
 			return
 		}
-
-		json.OK(w, r, map[string]any{"content": mediaproxy.RewriteDocumentWithRelativeProxyURL(h.router, entry.Content), "reading_time": entry.ReadingTime})
-
-		return
 	}
 
-	json.OK(w, r, map[string]string{"content": entry.Content})
+	json.OK(w, r, map[string]any{"content": mediaproxy.RewriteDocumentWithAbsoluteProxyURL(h.router, entry.Content), "reading_time": entry.ReadingTime})
 }
 
 func (h *handler) flushHistory(w http.ResponseWriter, r *http.Request) {