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

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: Slightly better: only letting images through. 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..26fdfd41802b8e9f2471d7e0581b7a19768cef8a 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[:9] == "/examples" and
Aaron Boodman 2011/12/14 21:42:15 startswith() ?
Mike West 2011/12/14 21:49:02 Learn something new every day... Using it now.
+ result.headers['content-type'][:6] != 'image/' and
+ result.headers['Content-Type'][:6] != '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