Skip to content

Commit

Permalink
Merge pull request #10850 from Vlad0n20/fix/ENG-6700
Browse files Browse the repository at this point in the history
[ENG-6700] Check and fix `website` tests
  • Loading branch information
cslzchen authored Dec 12, 2024
2 parents c06e1eb + 70ca5eb commit 9f2b980
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions website/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from addons.osfstorage.models import Region, OsfStorageFile

from osf import features, exceptions
from osf.models import Guid, Preprint, AbstractNode, Node, DraftNode, Registration, BaseFileNode
from osf.models import Guid, Preprint, AbstractNode, Node, DraftNode, Registration, BaseFileNode, VersionedGuidMixin

from website.settings import EXTERNAL_EMBER_APPS, PROXY_EMBER_APPS, EXTERNAL_EMBER_SERVER_TIMEOUT, DOMAIN
from website.ember_osf_web.decorators import ember_flag_is_active
Expand Down Expand Up @@ -290,17 +290,14 @@ def resolve_guid(guid, suffix=None):
if 'revision' in request.args:
return resolve_guid_download(guid)

# Retrieve guid data if present, error if missing
resource, _ = Guid.load_referent(guid)
if not resource:
# Retrieve resource and version from a guid str
resource, version = Guid.load_referent(guid)
if not resource or not resource.deep_url:
raise HTTPError(http_status.HTTP_404_NOT_FOUND)

if not guid == resource._id:
if version and guid != resource._id:
return redirect(f'/{resource._id}/{suffix}' if suffix else f'/{resource._id}/', code=302)

if not resource or not resource.deep_url:
raise HTTPError(http_status.HTTP_404_NOT_FOUND)

if isinstance(resource, DraftNode):
raise HTTPError(http_status.HTTP_404_NOT_FOUND)

Expand Down

0 comments on commit 9f2b980

Please sign in to comment.