[Multi Control][VD] Support drag & drop image to Office365 powerpoint 11/314911/3
authorjiangyuwei <yuwei.jiang@samsung.com>
Tue, 23 Jul 2024 06:43:33 +0000 (14:43 +0800)
committerBot Blink <blinkbot@samsung.com>
Wed, 31 Jul 2024 05:43:36 +0000 (05:43 +0000)
We can not drop some images when drag them to Office365 powerpoint,
because of Office365 powerpoint's CORS check.

This patch make a host whitelist to skip CORS check when drag and
drop image to Office365 powerpoint.

Change-Id: I4caede0dac6c355166a9b2e523e99edd294a0acd
Signed-off-by: jiangyuwei <yuwei.jiang@samsung.com>
services/network/public/cpp/cors/cors.cc

index 3991f7823b2d94bc304e248dceaa0bbb26d4ea3d..8bb5406425394ba40626aa007990d795bb8980ba 100644 (file)
@@ -263,6 +263,21 @@ bool ShouldCheckCors(const GURL& request_url,
 
   if (request_initiator->IsSameOriginWith(request_url))
     return false;
+
+#if BUILDFLAG(IS_TIZEN_TV)
+  // Can not drop some images when drag them to Office365 powerpoint,
+  // because of Office365 powerpoint's CORS check.
+  // Make a host whitelist to skip CORS check when drag and drop image
+  // to Office365 powerpoint.
+  static constexpr auto ignore_cors_request_initiator_host = base::MakeFixedFlatSet<base::StringPiece>({
+    "powerpoint.officeapps.live.com"
+  });
+
+  if (base::Contains(ignore_cors_request_initiator_host, request_initiator->host())) {
+    LOG(INFO) << "url: " << request_url << " skip CORS check";
+    return false;
+  }
+#endif
   return true;
 }