Forráskód Böngészése

Fix: DOMParser error in fetch-rss function

The fetch-rss function was failing due to the absence of DOMParser in the Deno environment. This commit addresses the issue.
gpt-engineer-app[bot] 5 hónapja
szülő
commit
f0dc4a2057
1 módosított fájl, 3 hozzáadás és 2 törlés
  1. 3 2
      supabase/functions/fetch-rss/index.ts

+ 3 - 2
supabase/functions/fetch-rss/index.ts

@@ -1,6 +1,7 @@
 
 import { serve } from "https://deno.land/std@0.168.0/http/server.ts"
 import { createClient } from 'https://esm.sh/@supabase/supabase-js@2'
+import { DOMParser } from 'https://deno.land/x/deno_dom@v0.1.38/deno-dom-wasm.ts'
 
 interface RSSItem {
   title: string;
@@ -46,9 +47,9 @@ serve(async (req) => {
 
     const rssText = await response.text()
     
-    // Parse RSS using DOMParser
+    // Parse RSS using deno-dom DOMParser
     const parser = new DOMParser()
-    const doc = parser.parseFromString(rssText, 'application/xml')
+    const doc = parser.parseFromString(rssText, 'text/xml')
     
     if (!doc) {
       throw new Error('Failed to parse RSS XML')