Update maxAge and eTag for media files
authorMatthias Schmidt <gravatronics@live.com>
Sat, 27 Jun 2020 15:56:34 +0000 (17:56 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Sat, 27 Jun 2020 15:56:34 +0000 (17:56 +0200)
wcfsetup/install/files/lib/page/MediaPage.class.php

index 2311fad04a6fdb720600d44a329bcbf5959495ed..b78ae5816ddb079f766a8c665abea2f48ae5094c 100644 (file)
@@ -85,7 +85,10 @@ class MediaPage extends AbstractPage {
                        $this->eTag = $this->mediaID;
                }
                
+               $this->eTag .= '_' . $this->media->fileHash;
+               
                // init file reader
+               $maxAge = 3600;
                $this->fileReader = new FileReader($location, [
                        'filename' => $this->media->filename,
                        'mimeType' => $mimeType,
@@ -93,8 +96,8 @@ class MediaPage extends AbstractPage {
                        'showInline' => in_array($mimeType, self::$inlineMimeTypes),
                        'enableRangeSupport' => $this->thumbnail ? true : false,
                        'lastModificationTime' => $this->media->fileUpdateTime ?? $this->media->uploadTime,
-                       'expirationDate' => TIME_NOW + 31536000,
-                       'maxAge' => 31536000,
+                       'expirationDate' => TIME_NOW + $maxAge,
+                       'maxAge' => $maxAge,
                ]);
                
                if ($this->eTag !== null) {