Skip to content

Commit

Permalink
Make sure record-header.py can find some files it tries to open
Browse files Browse the repository at this point in the history
Differential Revision: https://phabricator.services.mozilla.com/D12360

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1508463
gecko-commit: 61a3be9a8fadeaa115abddde754576b36ef0f229
gecko-integration-branch: autoland
gecko-reviewers: jgraham
  • Loading branch information
KWierso authored and moz-wptsync-bot committed Nov 21, 2018
1 parent 9528b40 commit 6ef09d0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions fetch/sec-metadata/resources/record-header.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,23 +63,23 @@ def main(request, response):
## Return a valid font content and Content-Type ##
if key.startswith("font"):
response.headers.set("Content-Type", "application/x-font-ttf")
file = open("fonts/Ahem.ttf", "r")
file = open(os.path.join(request.doc_root, "fonts", "Ahem.ttf"), "r")
font = file.read()
file.close()
return font

## Return a valid audio content and Content-Type ##
if key.startswith("audio"):
response.headers.set("Content-Type", "audio/mpeg")
file = open("media/sound_5.mp3", "r")
file = open(os.path.join(request.doc_root, "media", "sound_5.mp3"), "r")
audio = file.read()
file.close()
return audio

## Return a valid video content and Content-Type ##
if key.startswith("video"):
response.headers.set("Content-Type", "video/mp4")
file = open("media/A4.mp4", "r")
file = open(os.path.join(request.doc_root, "media", "A4.mp4"), "r")
video = file.read()
file.close()
return video
Expand All @@ -92,7 +92,7 @@ def main(request, response):
## Return a valid image content and Content-Type for redirect requests ##
if key.startswith("redirect"):
response.headers.set("Content-Type", "image/jpeg")
file = open("media/1x1-green.png", "r")
file = open(os.path.join(request.doc_root, "media", "1x1-green.png"), "r")
image = file.read()
file.close()
return image
Expand Down

0 comments on commit 6ef09d0

Please sign in to comment.