Skip to content

Commit

Permalink
fix: remove scheme when _external=False. (#123)
Browse files Browse the repository at this point in the history
* fix: remove scheme when _external=False.

* add changelog fragment

---------

Co-authored-by: Brian Scholer <[email protected]>
  • Loading branch information
debben and briantist authored Oct 14, 2023
1 parent 5dae6f8 commit 53b3984
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 21 deletions.
3 changes: 3 additions & 0 deletions changelogs/fragments/123-relative-url-scheme.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
bugfixes:
- Using the ``PREFERRED_URL_SCHEME`` configuration option caused failure in Galaxy v3 due to its inapplicability to relative URLs. This now works correctly by not applying the preferred scheme to relative URLs, since they do not need to know the current scheme (https://github.com/briantist/galactory/issues/122, https://github.com/briantist/galactory/pull/123).
31 changes: 10 additions & 21 deletions galactory/api/v3/collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ def collections():
".collection",
namespace=colgroup.namespace,
collection=colgroup.name,
_external=False,
_scheme=scheme
_external=False
),
'name': colgroup.name,
'namespace': colgroup.namespace,
Expand All @@ -46,17 +45,15 @@ def collections():
".versions",
namespace=colgroup.latest.namespace,
collection=colgroup.latest.name,
_external=False,
_scheme=scheme,
_external=False
),
'highest_version': {
'href': url_for(
".version",
namespace=colgroup.latest.namespace,
collection=colgroup.latest.name,
version=colgroup.latest.version,
_external=False,
_scheme=scheme,
_external=False
),
"version": colgroup.latest.version,
},
Expand All @@ -66,7 +63,6 @@ def collections():
this_url = url_for(
".collections",
_external=False,
_scheme=scheme,
**request.args
)

Expand Down Expand Up @@ -134,8 +130,7 @@ def collection(namespace, collection):
".collection",
namespace=colgroup.namespace,
collection=colgroup.name,
_external=False,
_scheme=scheme
_external=False
),
'name': colgroup.latest.name,
'namespace': colgroup.latest.namespace,
Expand All @@ -146,17 +141,15 @@ def collection(namespace, collection):
".versions",
namespace=colgroup.latest.namespace,
collection=colgroup.latest.name,
_external=False,
_scheme=scheme,
_external=False
),
'highest_version': {
'href': url_for(
".version",
namespace=colgroup.latest.namespace,
collection=colgroup.latest.name,
version=colgroup.latest.version,
_external=False,
_scheme=scheme,
_external=False
),
"version": colgroup.latest.version,
},
Expand Down Expand Up @@ -200,8 +193,7 @@ def versions(namespace, collection):
namespace=i.namespace,
collection=i.name,
version=i.version,
_external=False,
_scheme=scheme,
_external=False
),
'version': i.version,
'created_at': i.created,
Expand All @@ -222,7 +214,6 @@ def versions(namespace, collection):
namespace=namespace,
collection=collection,
_external=False,
_scheme=scheme,
**request.args
)

Expand Down Expand Up @@ -283,8 +274,7 @@ def version(namespace, collection, version):
".collection",
namespace=info.namespace,
collection=info.name,
_external=False,
_scheme=scheme,
_external=False
),
'name': info.name,
},
Expand All @@ -304,8 +294,7 @@ def version(namespace, collection, version):
".collection",
namespace=info.namespace,
collection=info.name,
_external=False,
_scheme=scheme
_external=False
),
'id': 0,
'metadata': info.collection_info,
Expand Down Expand Up @@ -339,4 +328,4 @@ def publish():

upload_collection_from_hashed_tempfile(target, tmp, property_fallback=property_fallback)

return jsonify(task=url_for(".import_singleton", _external=False, _scheme=_scheme))
return jsonify(task=url_for(".import_singleton", _external=False))

0 comments on commit 53b3984

Please sign in to comment.