Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SVCS-256] Adding "undecoded_path" to providers #248

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions waterbutler/core/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ def __init__(self, auth: dict,
self.auth = auth
self.credentials = credentials
self.settings = settings
self.undecoded_path = None

self.provider_metrics = MetricsRecord('provider')
self.provider_metrics.add('auth', auth)
Expand Down
11 changes: 10 additions & 1 deletion waterbutler/server/api/v1/provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,17 @@ async def prepare(self, *args, **kwargs):

self.auth = await auth_handler.get(self.resource, provider, self.request)
self.provider = utils.make_provider(provider, self.auth['auth'], self.auth['credentials'], self.auth['settings'])
self.path = await self.provider.validate_v1_path(self.path, **self.arguments)

# Find start of provider name, and start of ? marker and pull out file name from between them.
provider_index = self.request.uri.index(self.path_kwargs['provider'] + '/')
provider_length = (len(self.path_kwargs['provider']))
end_of_path_index = self.request.uri.find('?')
# If there is no ? in uri, go to end of uri
if end_of_path_index == -1:
end_of_path_index = len(self.request.uri)

self.provider.undecoded_path = self.request.uri[provider_index + provider_length: end_of_path_index]
self.path = await self.provider.validate_v1_path(self.path, **self.arguments)
self.target_path = None

# post-validator methods perform validations that expect that the path given in the url has
Expand Down