Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
4795067a
Commit
4795067a
authored
8 years ago
by
Toby Lawrence
Browse files
Options
Downloads
Patches
Plain Diff
Cautiously grab the content digest.
parent
bb29ad5f
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
common/djangoapps/contentserver/middleware.py
+2
-2
2 additions, 2 deletions
common/djangoapps/contentserver/middleware.py
common/lib/xmodule/xmodule/contentstore/content.py
+1
-1
1 addition, 1 deletion
common/lib/xmodule/xmodule/contentstore/content.py
with
3 additions
and
3 deletions
common/djangoapps/contentserver/middleware.py
+
2
−
2
View file @
4795067a
...
...
@@ -67,13 +67,13 @@ class StaticContentServer(object):
actual_digest
=
None
try
:
content
=
self
.
load_asset_from_location
(
loc
)
actual_digest
=
content
.
content_digest
actual_digest
=
getattr
(
content
,
"
content_digest
"
,
None
)
except
(
ItemNotFoundError
,
NotFoundError
):
return
HttpResponseNotFound
()
# If this was a versioned asset, and the digest doesn't match, redirect
# 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
)
return
HttpResponsePermanentRedirect
(
actual_asset_path
)
...
...
This diff is collapsed.
Click to expand it.
common/lib/xmodule/xmodule/contentstore/content.py
+
1
−
1
View file @
4795067a
...
...
@@ -243,7 +243,7 @@ class StaticContent(object):
try
:
content
=
AssetManager
.
find
(
asset_key
,
as_stream
=
True
)
serve_from_cdn
=
not
getattr
(
content
,
"
locked
"
,
True
)
content_digest
=
content
.
content_digest
content_digest
=
getattr
(
content
,
"
content_digest
"
,
None
)
except
(
ItemNotFoundError
,
NotFoundError
):
# If we can't find the item, just treat it as if it's locked.
serve_from_cdn
=
False
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment