Procházet zdrojové kódy

Fixing mixed error

svalavuo před 10 hodinami
rodič
revize
4396bf83b0
1 změnil soubory, kde provedl 4 přidání a 6 odebrání
  1. 4 6
      backend/api/items.php

+ 4 - 6
backend/api/items.php

@@ -35,10 +35,9 @@ switch($request_method) {
                     // Remove /api/ from the beginning if present
                     $picture_url = str_replace('/api/', '', $picture_url);
                 }
-                // Ensure proper URL format
+                // Use relative URL to avoid mixed content warnings
                 if ($picture_url && !preg_match('/^https?:\/\//', $picture_url)) {
-                    $baseUrl = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]";
-                    $picture_url = $baseUrl . '/' . ltrim($picture_url, '/');
+                    $picture_url = '/' . ltrim($picture_url, '/');
                 }
                 
                 $item_arr = array(
@@ -81,10 +80,9 @@ switch($request_method) {
                         // Remove /api/ from the beginning if present
                         $picture_url = str_replace('/api/', '', $picture);
                     }
-                    // Ensure proper URL format
+                    // Use relative URL to avoid mixed content warnings
                     if ($picture_url && !preg_match('/^https?:\/\//', $picture_url)) {
-                        $baseUrl = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]";
-                        $picture_url = $baseUrl . '/' . ltrim($picture_url, '/');
+                        $picture_url = '/' . ltrim($picture_url, '/');
                     }
                     
                     $item_item = array(