Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
4795067a
Commit
4795067a
authored
Jun 23, 2016
by
Toby Lawrence
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cautiously grab the content digest.
parent
bb29ad5f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
+3
-3
common/djangoapps/contentserver/middleware.py
+2
-2
common/lib/xmodule/xmodule/contentstore/content.py
+1
-1
No files found.
common/djangoapps/contentserver/middleware.py
View file @
4795067a
...
@@ -67,13 +67,13 @@ class StaticContentServer(object):
...
@@ -67,13 +67,13 @@ class StaticContentServer(object):
actual_digest
=
None
actual_digest
=
None
try
:
try
:
content
=
self
.
load_asset_from_location
(
loc
)
content
=
self
.
load_asset_from_location
(
loc
)
actual_digest
=
content
.
content_digest
actual_digest
=
getattr
(
content
,
"content_digest"
,
None
)
except
(
ItemNotFoundError
,
NotFoundError
):
except
(
ItemNotFoundError
,
NotFoundError
):
return
HttpResponseNotFound
()
return
HttpResponseNotFound
()
# If this was a versioned asset, and the digest doesn't match, redirect
# If this was a versioned asset, and the digest doesn't match, redirect
# them to the actual version.
# them to the actual version.
if
requested_digest
is
not
None
and
(
actual_digest
!=
requested_digest
):
if
requested_digest
is
not
None
and
actual_digest
is
not
None
and
(
actual_digest
!=
requested_digest
):
actual_asset_path
=
StaticContent
.
add_version_to_asset_path
(
asset_path
,
actual_digest
)
actual_asset_path
=
StaticContent
.
add_version_to_asset_path
(
asset_path
,
actual_digest
)
return
HttpResponsePermanentRedirect
(
actual_asset_path
)
return
HttpResponsePermanentRedirect
(
actual_asset_path
)
...
...
common/lib/xmodule/xmodule/contentstore/content.py
View file @
4795067a
...
@@ -243,7 +243,7 @@ class StaticContent(object):
...
@@ -243,7 +243,7 @@ class StaticContent(object):
try
:
try
:
content
=
AssetManager
.
find
(
asset_key
,
as_stream
=
True
)
content
=
AssetManager
.
find
(
asset_key
,
as_stream
=
True
)
serve_from_cdn
=
not
getattr
(
content
,
"locked"
,
True
)
serve_from_cdn
=
not
getattr
(
content
,
"locked"
,
True
)
content_digest
=
content
.
content_digest
content_digest
=
getattr
(
content
,
"content_digest"
,
None
)
except
(
ItemNotFoundError
,
NotFoundError
):
except
(
ItemNotFoundError
,
NotFoundError
):
# If we can't find the item, just treat it as if it's locked.
# If we can't find the item, just treat it as if it's locked.
serve_from_cdn
=
False
serve_from_cdn
=
False
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment