Skip to content

Commit aa98494

Browse files
KonstantAnxietyNothing4You
authored andcommitted
check local_infile option when receiving a LOAD_LOCAL packet
1 parent fc1203e commit aa98494

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

aiomysql/connection.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,8 @@ def __init__(self, host="localhost", user=None, password="",
245245

246246
self._encoding = charset_by_name(self._charset).encoding
247247

248-
if local_infile:
248+
self._local_infile = bool(local_infile)
249+
if self._local_infile:
249250
client_flag |= CLIENT.LOCAL_FILES
250251

251252
client_flag |= CLIENT.CAPABILITIES
@@ -1203,6 +1204,10 @@ def _read_ok_packet(self, first_packet):
12031204
self.has_next = ok_packet.has_next
12041205

12051206
async def _read_load_local_packet(self, first_packet):
1207+
if not self.connection._local_infile:
1208+
raise RuntimeError(
1209+
"**WARN**: Received LOAD_LOCAL packet but local_infile option is false."
1210+
)
12061211
load_packet = LoadLocalPacketWrapper(first_packet)
12071212
sender = LoadLocalFile(load_packet.filename, self.connection)
12081213
try:

0 commit comments

Comments
 (0)