|
@@ -12,6 +12,7 @@ from sentry.api.base import region_silo_endpoint
|
|
|
from sentry.api.bases.project import ProjectEndpoint, ProjectReleasePermission
|
|
|
from sentry.api.endpoints.debug_files import has_download_permission
|
|
|
from sentry.api.serializers import serialize
|
|
|
+from sentry.lang.native.sources import get_internal_artifact_lookup_source_url
|
|
|
from sentry.models import DebugIdArtifactBundle, Distribution, File, Release, ReleaseFile
|
|
|
from sentry.models.artifactbundle import ArtifactBundleArchive, ReleaseArtifactBundle
|
|
|
from sentry.models.project import Project
|
|
@@ -116,7 +117,7 @@ class ProjectArtifactLookupEndpoint(ProjectEndpoint):
|
|
|
individual_files = try_resolve_urls(urls, project, release_name, dist_name, bundle_file_ids)
|
|
|
|
|
|
# Then: Construct our response
|
|
|
- url_constructor = UrlConstructor(request)
|
|
|
+ url_constructor = UrlConstructor(project)
|
|
|
|
|
|
found_artifacts = []
|
|
|
for file_id in bundle_file_ids:
|
|
@@ -325,9 +326,8 @@ def find_file_in_archive_index(archive_index: dict, url: str) -> Optional[File]:
|
|
|
|
|
|
|
|
|
class UrlConstructor:
|
|
|
- def __init__(self, request: Request):
|
|
|
- # TODO: is there a better way to construct a url to this same route?
|
|
|
- self.base_url = request.build_absolute_uri(request.path)
|
|
|
+ def __init__(self, project: Project):
|
|
|
+ self.base_url = get_internal_artifact_lookup_source_url(project)
|
|
|
|
|
|
def url_for_file_id(self, file_id: int) -> str:
|
|
|
# NOTE: Returning a self-route that requires authentication (via Bearer token)
|