mirror of
				https://github.com/getgrav/grav-plugin-admin.git
				synced 2025-10-31 02:16:26 +01:00 
			
		
		
		
	Sanitize Page Media
This commit is contained in:
		| @@ -2,7 +2,8 @@ | |||||||
| ## mm/dd/2019 | ## mm/dd/2019 | ||||||
|  |  | ||||||
| 1. [](#new) | 1. [](#new) | ||||||
|     * Add ability to Sanitize SVGs on upload |     * Add ability to Sanitize SVGs on file upload | ||||||
|  |     * Add ability to Sanitize SVGs in Page media | ||||||
|  |  | ||||||
| # v1.10.0-beta.7 | # v1.10.0-beta.7 | ||||||
| ## 08/30/2019 | ## 08/30/2019 | ||||||
|   | |||||||
| @@ -2087,7 +2087,6 @@ class AdminController extends AdminBaseController | |||||||
|             return false; |             return false; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  |  | ||||||
|         $media = $this->getMedia(); |         $media = $this->getMedia(); | ||||||
|         if (!$media) { |         if (!$media) { | ||||||
|             $this->admin->json_response = [ |             $this->admin->json_response = [ | ||||||
| @@ -2105,6 +2104,11 @@ class AdminController extends AdminBaseController | |||||||
|             $path = $locator->findResource($path, true, true); |             $path = $locator->findResource($path, true, true); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  |         // Special Sanitization for SVG | ||||||
|  |         if (Utils::contains($extension, 'svg', false)) { | ||||||
|  |             Security::sanitizeSVG($_FILES['file']['tmp_name']); | ||||||
|  |         } | ||||||
|  |  | ||||||
|         // Upload it |         // Upload it | ||||||
|         if (!move_uploaded_file($_FILES['file']['tmp_name'], sprintf('%s/%s', $path, $filename))) { |         if (!move_uploaded_file($_FILES['file']['tmp_name'], sprintf('%s/%s', $path, $filename))) { | ||||||
|             $this->admin->json_response = [ |             $this->admin->json_response = [ | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user