Safeguard against malformed domain paths caused by direct database manipulations
authorAlexander Ebert <ebert@woltlab.com>
Fri, 21 Feb 2020 13:04:04 +0000 (14:04 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Fri, 21 Feb 2020 13:04:04 +0000 (14:04 +0100)
wcfsetup/install/files/lib/data/application/Application.class.php

index e972c4dce694572d7558ec3356321aa515b5843a..fd85d0ae0b1ac3b06020e4215cdd2e051741e790 100644 (file)
@@ -53,6 +53,19 @@ class Application extends DatabaseObject {
         */
        protected static $directories = null;
        
+       /**
+        * @inheritDoc
+        */
+       protected function handleData($data) {
+               if (isset($data['domainPath'])) {
+                       // The leading and trailing slashes are required and enforced through the admin panel,
+                       // however, some users edit the database directly and omit them, causing incorrect urls.
+                       $data['domainPath'] = FileUtil::addLeadingSlash(FileUtil::addTrailingSlash($data['domainPath']));
+               }
+               
+               parent::handleData($data);
+       }
+       
        /**
         * Returns the abbreviation of the application.
         *