Skip to content

Commit

Permalink
unquote unsignedArtifacts paths
Browse files Browse the repository at this point in the history
  • Loading branch information
escapewindow committed Aug 23, 2016
1 parent 15906b8 commit e5f659c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -3,6 +3,8 @@ All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## Unreleased
### Changed
- `unsignedArtifacts` url paths are now unquoted, so `%2F` becomes `/`

## [0.4.0] - 2016-08-19
### Added
Expand Down
9 changes: 5 additions & 4 deletions scriptworker/client.py
Expand Up @@ -8,7 +8,7 @@
import jsonschema
import os
import re
from urllib.parse import urlparse
from urllib.parse import urlparse, unquote

from scriptworker.config import DEFAULT_CONFIG
from scriptworker.exceptions import ScriptWorkerTaskException
Expand Down Expand Up @@ -118,7 +118,8 @@ def validate_artifact_url(config, url):
else:
validate_config[key] = DEFAULT_CONFIG[key]
parts = urlparse(url)
return_value = parts.path
path = unquote(parts.path)
return_value = path
# scheme whitelisted?
if validate_config['valid_artifact_schemes'] is not None and \
parts.scheme not in validate_config['valid_artifact_schemes']:
Expand All @@ -129,7 +130,7 @@ def validate_artifact_url(config, url):
messages.append('Invalid netloc: {}!'.format(parts.netloc))
# check the paths
for regex in validate_config.get('valid_artifact_path_regexes') or []:
m = re.search(regex, parts.path)
m = re.search(regex, path)
if m is None:
continue
path_info = m.groupdict()
Expand All @@ -145,7 +146,7 @@ def validate_artifact_url(config, url):
break
else:
if validate_config.get('valid_artifact_path_regexes'):
messages.append('Invalid path: {}!'.format(parts.path))
messages.append('Invalid path: {}!'.format(path))

if messages:
raise ScriptWorkerTaskException(
Expand Down

0 comments on commit e5f659c

Please sign in to comment.