mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2026-10-31 08:34:01 -05:00
Fixed API test case for restore.
This commit is contained in:
1 parent
f251fdfdb1
commit
60c56b3285
1 file changed
+14
-9
@@ -384,17 +384,22 @@ def has_meta_commands(path, chunk_size=8 * 1024 * 1024):
|
||||
# optional spaces, then backslash
|
||||
pattern = re.compile(br'(^|\n)[ \t]*\\')
|
||||
|
||||
with open(path, "rb") as f:
|
||||
prev_tail = b""
|
||||
while chunk := f.read(chunk_size):
|
||||
data = prev_tail + chunk
|
||||
try:
|
||||
with open(path, "rb") as f:
|
||||
prev_tail = b""
|
||||
while chunk := f.read(chunk_size):
|
||||
data = prev_tail + chunk
|
||||
|
||||
# Search for pattern
|
||||
if pattern.search(data):
|
||||
return True
|
||||
# Search for pattern
|
||||
if pattern.search(data):
|
||||
return True
|
||||
|
||||
# Keep a small tail to preserve line boundary context
|
||||
prev_tail = data[-10:] # keep last few bytes
|
||||
# Keep a small tail to preserve line boundary context
|
||||
prev_tail = data[-10:] # keep last few bytes
|
||||
except FileNotFoundError:
|
||||
current_app.logger.error("File not found.")
|
||||
except PermissionError:
|
||||
current_app.logger.error("Insufficient permissions to access.")
|
||||
|
||||
return False
|
||||
|
||||
|
||||
Reference in new issue
Block a user