def fix_file_urls():
	for file in frappe.db.sql_list("""select name from `tabFile` where file_url like 'files/%'"""):
		file = frappe.get_doc("File", file)
		file.db_set("file_url", "/" + file.file_url, update_modified=False)
		try:
			file.validate_file()
			file.db_set("file_name", file.file_name, update_modified=False)
			if not file.content_hash:
				file.generate_content_hash()
				file.db_set("content_hash", file.content_hash, update_modified=False)

		except __HOLE__:
			pass
dataset/ETHPy150Open frappe/frappe/frappe/patches/v6_6/fix_file_url.py/fix_file_urls