kopia lustrzana https://github.com/simonw/datasette
Fixed bug with .json path regular expression
I had a table called "geojson" and it caused an exception because the regex was matching .json and not \.jsonpull/178/head
rodzic
4f08fc092f
commit
1aad396c9e
|
@ -998,7 +998,7 @@ class Datasette:
|
||||||
self.jinja_env.filters['quote_plus'] = lambda u: urllib.parse.quote_plus(u)
|
self.jinja_env.filters['quote_plus'] = lambda u: urllib.parse.quote_plus(u)
|
||||||
self.jinja_env.filters['escape_table_name'] = escape_sqlite_table_name
|
self.jinja_env.filters['escape_table_name'] = escape_sqlite_table_name
|
||||||
self.jinja_env.filters['to_css_class'] = to_css_class
|
self.jinja_env.filters['to_css_class'] = to_css_class
|
||||||
app.add_route(IndexView.as_view(self), '/<as_json:(.jsono?)?$>')
|
app.add_route(IndexView.as_view(self), '/<as_json:(\.jsono?)?$>')
|
||||||
# TODO: /favicon.ico and /-/static/ deserve far-future cache expires
|
# TODO: /favicon.ico and /-/static/ deserve far-future cache expires
|
||||||
app.add_route(favicon, '/favicon.ico')
|
app.add_route(favicon, '/favicon.ico')
|
||||||
app.static('/-/static/', str(app_root / 'datasette' / 'static'))
|
app.static('/-/static/', str(app_root / 'datasette' / 'static'))
|
||||||
|
@ -1006,7 +1006,7 @@ class Datasette:
|
||||||
app.static(path, dirname)
|
app.static(path, dirname)
|
||||||
app.add_route(
|
app.add_route(
|
||||||
DatabaseView.as_view(self),
|
DatabaseView.as_view(self),
|
||||||
'/<db_name:[^/\.]+?><as_json:(.jsono?)?$>'
|
'/<db_name:[^/\.]+?><as_json:(\.jsono?)?$>'
|
||||||
)
|
)
|
||||||
app.add_route(
|
app.add_route(
|
||||||
DatabaseDownload.as_view(self),
|
DatabaseDownload.as_view(self),
|
||||||
|
@ -1014,10 +1014,10 @@ class Datasette:
|
||||||
)
|
)
|
||||||
app.add_route(
|
app.add_route(
|
||||||
TableView.as_view(self),
|
TableView.as_view(self),
|
||||||
'/<db_name:[^/]+>/<table:[^/]+?><as_json:(.jsono?)?$>'
|
'/<db_name:[^/]+>/<table:[^/]+?><as_json:(\.jsono?)?$>'
|
||||||
)
|
)
|
||||||
app.add_route(
|
app.add_route(
|
||||||
RowView.as_view(self),
|
RowView.as_view(self),
|
||||||
'/<db_name:[^/]+>/<table:[^/]+?>/<pk_path:[^/]+?><as_json:(.jsono?)?$>'
|
'/<db_name:[^/]+>/<table:[^/]+?>/<pk_path:[^/]+?><as_json:(\.jsono?)?$>'
|
||||||
)
|
)
|
||||||
return app
|
return app
|
||||||
|
|
Ładowanie…
Reference in New Issue