Skip to content

Commit

Permalink
Merge pull request #84 from TsimpDim/share-multiple-tags
Browse files Browse the repository at this point in the history
Fix sharing multiple tags
  • Loading branch information
TsimpDim committed Nov 23, 2018
2 parents c63dc13 + c150c68 commit 553eae7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions _3RStore/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1012,6 +1012,7 @@ def share():

if(request.method == 'POST'):
tags = request.form.get('tags')
tags = [t.lower() for t in tags.split(',')]

if not tags:
flash('No tags selected. Can\'t share.', 'danger')
Expand All @@ -1032,7 +1033,8 @@ def share():
cur.close()
conn.commit()

if tags not in tags_used_clean:

if any(tag not in tags_used_clean for tag in tags):
flash('No such tag exists. Can\'t share.', 'danger')
return redirect(url_for('resources'))

Expand All @@ -1044,7 +1046,7 @@ def share():
token = serializer.dumps([session['user_id'],tags], salt='share-salt'),
_external=True)

message = Markup("Resources containing {" + tags + "} can be publicly accessed for 3 days via the following link: <a href=" + share_url + ">Link</a>")
message = Markup("Resources containing {" + ','.join(tags) + "} can be publicly accessed for 3 days via the following link: <a href=" + share_url + ">Link</a>")
flash(message, 'info')

return redirect(url_for('resources'))
Expand Down

0 comments on commit 553eae7

Please sign in to comment.