diff options
-rw-r--r-- | paste/__init__.py | 7 | ||||
-rw-r--r-- | paste/store.py | 3 |
2 files changed, 6 insertions, 4 deletions
diff --git a/paste/__init__.py b/paste/__init__.py index 83cd6b5..f22b5d7 100644 --- a/paste/__init__.py +++ b/paste/__init__.py @@ -263,7 +263,8 @@ def application(environ: Env, start_response: StartResponse) -> Response: ) return [] elif environ["REQUEST_METHOD"] == "DELETE": - store.delete(conn, name) - start_response("204 No Content", []) - return [] + if store.delete(conn, name): + start_response("204 No Content", []) + return [] + return simple_response(start_response, "404 Not Found") return simple_response(start_response, "500 Internal Server Error") diff --git a/paste/store.py b/paste/store.py index 82e66c0..ec51a7f 100644 --- a/paste/store.py +++ b/paste/store.py @@ -54,4 +54,5 @@ def head(conn: Connection, name: str): def delete(conn: Connection, name: str): with conn: - conn.execute("DELETE FROM link WHERE name_hash = DATA_HASH(?)", (name,)) + cur = conn.execute("DELETE FROM link WHERE name_hash = DATA_HASH(?)", (name,)) + return cur.rowcount == 1 |