@@ -97,6 +97,7 @@ nelmio_security:
- 'https://www.gravatar.com/'
- 'https://*.githubusercontent.com'
- 'https://raw.github.com/'
+ - 'https://rawcdn.githack.com/'
- 'https://github.com/'
- 'https://gitlab.com/'
- 'https://www.google-analytics.com/'
@@ -484,6 +484,16 @@ class Package
return $this->readme;
}
+ /**
+ * Get readme with transformations that should not be done in the stored readme as they might not be valid in the long run
+ *
+ * @return string
+ */
+ public function getOptimizedReadme()
+ {
+ return str_replace(['<img src="https://raw.github.com/', '<img src="https://raw.githubusercontent.com/'], '<img src="https://rawcdn.githack.com/', $this->readme);
+ }
+
/**
* @param int $val
*/
@@ -276,7 +276,7 @@
<hr class="clearfix">
<div class="readme markdown-body">
<h1>README</h1>
- {{ package.readme|raw }}
+ {{ package.optimizedReadme|raw }}
</div>
{% endif %}