Explorar o código

Bugfix. Use https for encrypted media unless hosted via localhost

JC Brand %!s(int64=2) %!d(string=hai) anos
pai
achega
18d8b69f00
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      src/plugins/omemo/utils.js

+ 1 - 1
src/plugins/omemo/utils.js

@@ -167,7 +167,7 @@ async function downloadFile(url) {
 
 async function getAndDecryptFile (uri) {
     const hash = uri.hash().slice(1);
-    const protocol = window.location.hostname === 'localhost' ? 'http' : 'https';
+    const protocol = (window.location.hostname === 'localhost' && uri.domain() === 'localhost') ? 'http' : 'https';
     const http_url = uri.toString().replace(/^aesgcm/, protocol);
     const cipher = await downloadFile(http_url);
     if (cipher === null) {