Skip to content

Commit 507a4b8

Browse files
author
Arjan
committed
Fixed SQL injection issue. Renamed main Flask entry file to app.py. Updated .gitignore file.
1 parent 6608d5c commit 507a4b8

File tree

6 files changed

+4
-3
lines changed

6 files changed

+4
-3
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
# misc
2-
.DS_Store
2+
.DS_Store
3+
*.pyc

7 - dealing with errors/after-context/db.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def fetch_blog(id: str):
4343
with SQLite('application.db') as cur:
4444

4545
# execute the query and fetch the data
46-
cur.execute(f"SELECT * FROM blogs where id='{id}'")
46+
cur.execute(f"SELECT * FROM blogs where id=?", [id])
4747
result = cur.fetchone()
4848

4949
# return the result or raise an error

7 - dealing with errors/after/db.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def fetch_blog(id: str):
4343
cur = con.cursor()
4444

4545
# execute the query and fetch the data
46-
cur.execute(f"SELECT * FROM blogs where id='{id}'")
46+
cur.execute(f"SELECT * FROM blogs where id=?", [id])
4747
result = cur.fetchone()
4848

4949
# return the result or raise an error

0 commit comments

Comments
 (0)