mirror of
https://github.com/valitydev/redash.git
synced 2024-11-07 09:28:51 +00:00
Catch the error and respond with 404
This commit is contained in:
parent
dfb7cc1934
commit
e7d6ac07c9
@ -12,7 +12,7 @@ from redash import models, settings, utils
|
||||
from redash import serializers
|
||||
from redash.utils import json_dumps, collect_parameters_from_request, gen_query_hash
|
||||
from redash.handlers import routes
|
||||
from redash.handlers.base import org_scoped_rule, record_event
|
||||
from redash.handlers.base import org_scoped_rule, record_event, get_object_or_404
|
||||
from redash.handlers.query_results import collect_query_parameters
|
||||
from redash.permissions import require_access, view_only
|
||||
from authentication import current_org
|
||||
@ -125,12 +125,7 @@ def embed(query_id, visualization_id, org_slug=None):
|
||||
def public_dashboard(token, org_slug=None):
|
||||
# TODO: verify object is a dashboard?
|
||||
if not isinstance(current_user, models.ApiUser):
|
||||
try:
|
||||
api_key = models.ApiKey.get_by_api_key(token)
|
||||
except models.ApiKey.DoesNotExist, e:
|
||||
response = render_template("404.html")
|
||||
return response, 404
|
||||
|
||||
api_key = get_object_or_404(models.ApiKey.get_by_api_key, token)
|
||||
dashboard = api_key.object
|
||||
else:
|
||||
dashboard = current_user.object
|
||||
|
Loading…
Reference in New Issue
Block a user