From 879bc49709d5a10c13c3d037c3cc1a68b176a8cd Mon Sep 17 00:00:00 2001
From: Darren Fisher <60905-darren.fisher@users.noreply.drupalcode.org>
Date: Fri, 3 Jan 2025 12:55:37 +0000
Subject: [PATCH] Fix placement of default response in system_file_download
 function.

---
 core/modules/system/system.module | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/core/modules/system/system.module b/core/modules/system/system.module
index 230d476eb094..1bd00adeb899 100644
--- a/core/modules/system/system.module
+++ b/core/modules/system/system.module
@@ -587,8 +587,6 @@ function system_file_download($uri): Response {
         if (array_intersect($parts, ['.', '..'])) {
           return -1;
         }
-        // Default response when the file is not found.
-        return new Response('File not found', 404);
       }
     }
   }
@@ -605,6 +603,9 @@ function system_file_download($uri): Response {
       ];
     }
   }
+
+  // Default response when the file is not found.
+  return new Response('File not found', 404);
 }
 
 /**
-- 
GitLab