Skip to content

Commit

Permalink
Switching from path param to query param
Browse files Browse the repository at this point in the history
  • Loading branch information
ostyn committed Mar 27, 2017
1 parent 5e56a2b commit d08487d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions backend/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@
compress = Compress(app)
access_token = "YOUR_TOKEN_HERE"

@app.route('/oneDriveImageProxy/<path:url>')
def oneDriveImageProxy(url):
url = unquote(url)
@app.route('/oneDriveImageProxy', methods=['GET'])
def oneDriveImageProxy():
url = unquote(request.args.get('url'))
parsedUrl = urlparse(url)
if not (parsedUrl.netloc.endswith('livefilestore.com')):
return jsonify({'error':"Image source not supported."})
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/converters/markdown-format.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class MarkdownFormatValueConverter {
type: 'output',
filter: function (text, converter, options) {
return text.replace(imgRegex, function (match, url, rest) {
var addon = 'onerror="this.onerror=null;this.src=\'http://regretless.life/data/oneDriveImageProxy/\' + encodeURIComponent(this.src);" ';
var addon = 'onerror="this.onerror=null;this.src=\'http://regretless.life/data/oneDriveImageProxy?url=\' + encodeURIComponent(this.src);" ';
return match.replace("<img ", "<img " + addon);
});
}
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/widgets/post-widget.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
<center>
<a if.bind="showTitleLink" class="titleLink" route-href="route: post; params.bind: getLinkParams(post)">
<div class="header">
<img class="headerImage" src="${post.heroPhotoUrl}" onerror="this.onerror=null;this.src='http://regretless.life/data/oneDriveImageProxy/' + encodeURIComponent(this.src);">
<img class="headerImage" src="${post.heroPhotoUrl}" onerror="this.onerror=null;this.src='http://regretless.life/data/oneDriveImageProxy?url=' + encodeURIComponent(this.src);">
<div class="postTitle">${post.title}</div>
</div>
</a>
<div if.bind="!showTitleLink" class="titleLink">
<div class="header">
<img class="headerImage" src="${post.heroPhotoUrl}" onerror="this.onerror=null;this.src='http://regretless.life/data/oneDriveImageProxy/' + encodeURIComponent(this.src);">
<img class="headerImage" src="${post.heroPhotoUrl}" onerror="this.onerror=null;this.src='http://regretless.life/data/oneDriveImageProxy?url=' + encodeURIComponent(this.src);">
<div class="postTitle">${post.title}</div>
</div>
</div>
Expand Down

0 comments on commit d08487d

Please sign in to comment.