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

Fix err: Offline CSS url transcode
Fix err: Crawler referer url encoding

HOME 5 hónapja
szülő
commit
48d0ce7813
2 módosított fájl, 3 hozzáadás és 2 törlés
  1. 1 1
      Rac.Core/Tools/LinkProcessor.cs
  2. 2 1
      Rac.Core/Tools/Requester.cs

+ 1 - 1
Rac.Core/Tools/LinkProcessor.cs

@@ -36,7 +36,7 @@ namespace Rac.Tools
 
         public static string ReplaceCssLinks(string css, Func<string, string> func)
         {
-            var links = FromCss(css).OrderByDescending(p => p.Length).Distinct().ToArray();
+            var links = FromCss(css).OrderByDescending(p => p.Length).Distinct().Where(s => string.IsNullOrWhiteSpace(s) == false).ToArray();
             foreach (var link in links)
             {
                 if (link != "//")

+ 2 - 1
Rac.Core/Tools/Requester.cs

@@ -1,5 +1,6 @@
 using Rac.Models;
 using System.Net;
+using System;
 
 namespace Rac.Tools
 {
@@ -12,7 +13,7 @@ namespace Rac.Tools
         {
             var req = WebRequest.CreateHttp(url);
             req.UserAgent = "RawArchiveCrawler";
-            if (referer != null) req.Referer = referer;
+            if (referer != null) req.Referer = new Uri(referer).AbsoluteUri;
 
             req.AllowAutoRedirect = false; //record redirections