Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Gecko Bug 1508463] Make sure record-header.py can find some files it tries to open #14162

Merged
merged 1 commit into from
Nov 21, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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