Merged in bugfix/HTTPASTE-45/toolcahin (pull request #47)
Bugfix/HTTPASTE-45/toolcahin
This commit is contained in:
commit
2de4870269
3 changed files with 6 additions and 4 deletions
|
|
@ -6,7 +6,7 @@ from httpaste.helper.common import decode, DecodeError, join_url
|
||||||
import httpaste.model.paste as paste_model
|
import httpaste.model.paste as paste_model
|
||||||
import httpaste.model.user as user_model
|
import httpaste.model.user as user_model
|
||||||
from httpaste.backend import load_backend
|
from httpaste.backend import load_backend
|
||||||
from httpaste.helper.http import BadRequestError, GoneError, NotFoundError
|
from httpaste.helper.http import BadRequestError, GoneError, NotFoundError, ForbiddenError
|
||||||
from httpaste.helper.syntax import highlight
|
from httpaste.helper.syntax import highlight
|
||||||
from httpaste.schema import (
|
from httpaste.schema import (
|
||||||
PasteKey,
|
PasteKey,
|
||||||
|
|
|
||||||
|
|
@ -54,12 +54,14 @@ def get(**kwargs):
|
||||||
|
|
||||||
template = views.get_template("viewport/ui/paste/get.html")
|
template = views.get_template("viewport/ui/paste/get.html")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
base_path = f'paste/public/{kwargs["id"]}'
|
base_path = f'paste/public/{kwargs["id"]}'
|
||||||
|
|
||||||
raw_paste_url = f'{request.host_url}{base_path}'
|
|
||||||
if kwargs.get('user'):
|
if kwargs.get('user'):
|
||||||
raw_paste_url = f'{request.host_url}{base_path}'
|
base_path = f'paste/private/{kwargs["id"]}'
|
||||||
|
|
||||||
|
raw_paste_url = f'{request.host_url}{base_path}'
|
||||||
paste_url = raw_paste_url
|
paste_url = raw_paste_url
|
||||||
|
|
||||||
paste_url_query = {}
|
paste_url_query = {}
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ def load(proto: Paste, backend: object) -> Optional[Paste]:
|
||||||
if proto.sub and model.sub != shash(
|
if proto.sub and model.sub != shash(
|
||||||
proto.sub,
|
proto.sub,
|
||||||
model.data_hash,
|
model.data_hash,
|
||||||
proto.pid) or not proto.sub and model.sub:
|
proto.pid) or (not proto.sub and model.sub):
|
||||||
|
|
||||||
raise SubError('Paste not owned by user')
|
raise SubError('Paste not owned by user')
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue