Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5602)

Unified Diff: chrome/common/extensions/docs/server/chromeextensionsdocs.py

Issue 8942001: Force 'text/plain' rendering for HTML, CSS, and JS sample files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Startswith. Python is so clever. Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/extensions/docs/server/app.yaml ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/docs/server/chromeextensionsdocs.py
diff --git a/chrome/common/extensions/docs/server/chromeextensionsdocs.py b/chrome/common/extensions/docs/server/chromeextensionsdocs.py
index e74462374a118f2a33981c18c12c02f6cad400ae..71fcacc85eec924ff2c3aab3b25852f71702d368 100644
--- a/chrome/common/extensions/docs/server/chromeextensionsdocs.py
+++ b/chrome/common/extensions/docs/server/chromeextensionsdocs.py
@@ -76,6 +76,13 @@ class MainPage(webapp.RequestHandler):
if result.status_code != 200:
logging.error("urlfetch failed: " + url)
# TODO(nickbaum): what should we do when the urlfetch fails?
+ # Files inside of samples should be rendered with content-type
+ # text/plain so that their source is visible when linked to. The only
+ # types we should serve as-is are images.
+ if (path.startswith("/examples") and
+ not (result.headers['content-type'].startswith('image/') or
+ result.headers['Content-Type'].startswith('image/'))):
+ result.headers['content-type'] = 'text/plain'
except:
logging.error("urlfetch failed: " + url)
# TODO(nickbaum): what should we do when the urlfetch fails?
« no previous file with comments | « chrome/common/extensions/docs/server/app.yaml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698