Attach File in Web Form Child Table fails

Hi all,

I observe the following issue: I have a custom doctype “request”, which has a child table “request file”, which has a field of type “Attach”. In the desk version, this works nicely to attach multiple files to the doctype record.

Now, I have a web form for the same doctype to allow portal users to place requests and attach files. The form works well, however, as soon as a file is attached, saving is no longer possible and the console shows the following error message:

Failed to load resource: the server responded with a status of 500 (INTERNAL SERVER ERROR)
frappe-web.min.js:960 Traceback (most recent call last):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/", line 62, in application
	response = frappe.handler.handle()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/", line 22, in handle
	data = execute_cmd(cmd)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/", line 53, in execute_cmd
	return, **frappe.form_dict)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/", line 939, in call
	return fn(*args, **newargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/website/doctype/web_form/", line 401, in accept
	doc.insert(ignore_permissions = True)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/", line 240, in insert
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/", line 303, in db_insert
	), list(d.values()))
  File "/home/frappe/frappe-bench/apps/frappe/frappe/", line 166, in sql
	self._cursor.execute(query, values)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/", line 170, in execute
	result = self._query(query)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/", line 328, in _query
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/", line 516, in query
	self._affected_rows = self._read_query_result(unbuffered=unbuffered)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/", line 727, in _read_query_result
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/", line 1066, in read
	first_packet = self.connection._read_packet()
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/", line 683, in _read_packet
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/", line 220, in check_error
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/", line 109, in raise_mysql_exception
	raise errorclass(errno, errval)
ProgrammingError: (1064, u'You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near \': \'1\', u\'dataurl\': u"\'data:application/pdf;base64,JVBERi0xLjUNJeLjz9MNCjE3IDAgb2\' at line 2')

This is observed in ERPNext: v10.1.52 / Frappe Framework: v10.1.47

Is this a known issue? Any workarounds/solutions?

Linking the corresponding GitHub issue for reference: