Ver Fonte

try/catch clauses should contain as little code as possible

To avoid catching unrelated errors, which can mask other issues in the
code and make debugging more difficult
JC Brand há 4 anos atrás
pai
commit
eb016a2aa4
1 ficheiros alterados com 4 adições e 3 exclusões
  1. 4 3
      src/utils/html.js

+ 4 - 3
src/utils/html.js

@@ -84,10 +84,11 @@ u.isImageURL = url => {
     return regex ? regex.test(url) : u.isURLWithImageExtension(url);
 }
 u.isImageDomainAllowed = url => {
+    const show_images_inline = api.settings.get('show_images_inline');
+    if (!Array.isArray(show_images_inline)) {
+        return true;
+    }
     try {
-        const show_images_inline = api.settings.get('show_images_inline');
-        const is_domains_array = Array.isArray(show_images_inline);
-        if (!is_domains_array) return true;
         const image_domain = getURI(url).domain();
         return show_images_inline.includes(image_domain);
     } catch (error) {