feat: make manual-images list dynamic and resolve checkmark encoding issues

This commit is contained in:
Rafhan Mazaya Fathurrahman committed 2026-07-02 16:57:47 +07:00
1 parent a211593f2c
commit 43e6eea253
7 files changed
+57 -40

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
import os
import glob
def main():
uploads_dir = "backend/uploads"
if not os.path.exists(uploads_dir):
uploads_dir = "uploads"
manual_pattern = os.path.join(uploads_dir, "manual_label_*.json")
manual_files = glob.glob(manual_pattern)
fixed_count = 0
for mf in manual_files:
try:
with open(mf, "r", encoding="utf-8") as f:
content = f.read()
if "✓" in content:
# Replace with the correct checkmark character
content = content.replace("✓", "✓")
with open(mf, "w", encoding="utf-8") as f:
f.write(content)
print(f"Fixed encoding corruption in: {mf}")
fixed_count += 1
except Exception as e:
print(f"Error fixing {mf}: {e}")
print(f"Encoding fix completed. Files fixed: {fixed_count}")
if __name__ == "__main__":
main()