|
|
|
@ -228,8 +228,12 @@ def get_save_image_path(filename_prefix, output_dir, image_width=0, image_height
|
|
|
|
|
full_output_folder = os.path.join(output_dir, subfolder) |
|
|
|
|
|
|
|
|
|
if os.path.commonpath((output_dir, os.path.abspath(full_output_folder))) != output_dir: |
|
|
|
|
print("Saving image outside the output folder is not allowed.") |
|
|
|
|
return {} |
|
|
|
|
err = "**** ERROR: Saving image outside the output folder is not allowed." + \ |
|
|
|
|
"\n full_output_folder: " + os.path.abspath(full_output_folder) + \ |
|
|
|
|
"\n output_dir: " + output_dir + \ |
|
|
|
|
"\n commonpath: " + os.path.commonpath((output_dir, os.path.abspath(full_output_folder))) |
|
|
|
|
print(err) |
|
|
|
|
raise Exception(err) |
|
|
|
|
|
|
|
|
|
try: |
|
|
|
|
counter = max(filter(lambda a: a[1][:-1] == filename and a[1][-1] == "_", map(map_filename, os.listdir(full_output_folder))))[0] + 1 |
|
|
|
|