Zum Hauptinhalt springen
Echtzeit-Radar & Feeds
Alle RSS Feeds ➔
👥 Community & Social
IT Security ToolsHashcatRosetta(02.10.2026 um 19:23 Uhr)
•
IT Security NachrichtenThe legal questions raised by agentic AI hacks(02.10.2026 um 19:47 Uhr)
••
Sicherheitslücken (CVE)FortiMail zero-day exploited in attacks as CISA urges immediate patching(02.10.2026 um 19:28 Uhr)
•
IT Security NachrichtenNew infosec products of the week: October 2, 2026(02.10.2026 um 06:00 Uhr)
•
IT Security NachrichtenAI agents keep access to company data after their work is done(02.10.2026 um 06:30 Uhr)
••
Malware / Trojaner / VirenAndroid 17 makes it harder for spyware to cover its tracks(02.10.2026 um 07:30 Uhr)
•
IT Security NachrichtenCriminal recruiters want people on your payroll(02.10.2026 um 08:00 Uhr)
•
Sicherheitslücken (CVE)Critical FortiMail zero-day exploited in the wild (CVE-2026-104286)(02.10.2026 um 10:50 Uhr)
•
IT Security ToolsHashcatRosetta(02.10.2026 um 19:23 Uhr)
•
IT Security NachrichtenThe legal questions raised by agentic AI hacks(02.10.2026 um 19:47 Uhr)
••
Sicherheitslücken (CVE)FortiMail zero-day exploited in attacks as CISA urges immediate patching(02.10.2026 um 19:28 Uhr)
•
IT Security NachrichtenNew infosec products of the week: October 2, 2026(02.10.2026 um 06:00 Uhr)
•
IT Security NachrichtenAI agents keep access to company data after their work is done(02.10.2026 um 06:30 Uhr)
••
Malware / Trojaner / VirenAndroid 17 makes it harder for spyware to cover its tracks(02.10.2026 um 07:30 Uhr)
•
IT Security NachrichtenCriminal recruiters want people on your payroll(02.10.2026 um 08:00 Uhr)
•
Sicherheitslücken (CVE)Critical FortiMail zero-day exploited in the wild (CVE-2026-104286)(02.10.2026 um 10:50 Uhr)
•
Intelligence View
⚡ tsecurity.de Intelligence

🧨 The Bugs That Almost Broke Sortify (And How I Crushed Them)

Let me tell you something. Apps don’t usually break because of complex algorithms. They break because of: A 0-byte file. A random binary blob pretending to be t…

Beitrag
0
Seite
0
↗ Quelle (dev.to)
Social ReaktionenReagiere als Erste:r — dein Feedback zählt!

Let me tell you something.



Apps don’t usually break because of complex algorithms.



They break because of:




  • A 0-byte file.

  • A random binary blob pretending to be text.

  • A filename like report:final*version?.docx

  • Or an undo operation that travels back in time… badly.



Sortify ran into all of these.

So I did what every developer eventually has to do:



I went into defensive programming mode.



This is the story of how I hardened Sortify’s invalid input handling — and made it way more stable in the process.




Check it out on GitHub:

🔗 Sortify — automatic file organizer








🗂️ 1. The “Empty File” Problem



You’d think an empty file wouldn’t be dangerous.



It’s literally nothing.



But that’s the problem.



No content → extraction logic behaves weirdly → AI categorization becomes unreliable.



So now we explicitly detect 0-byte files before doing anything:




if file_size_bytes == 0:
logging.warning(f"Empty file detected (0 bytes): {file_path}")









What happens now?




  • ✅ Empty files are detected instantly

  • ✅ Logged properly

  • ✅ Categorized using filename only

  • ✅ No crashes

  • ✅ No silent weirdness



Instead of “why did this behave strangely?”

Now it’s “Ah, it’s empty. Makes sense.”



Predictable > Magical.







💣 2. Binary Files Pretending to Be Text



This one was sneaky.



Some files looked harmless.



But internally?



Binary junk.



And when text extraction libraries try to read binary data…



You get:




  • Exceptions

  • Garbage output

  • Or mysterious failures



So I built a binary detector.







🧠 How It Works



We check:




  • First 8KB of the file

  • Presence of null bytes (\x00)

  • Ratio of non-printable characters



If more than 30% of characters are non-printable, we treat it as binary.



Why 30%?



Because real text files don’t look like corrupted alien transmissions.







If file is binary:





logging.info("Binary file detected, skipping content extraction")





And we:




  • ✅ Skip text extraction

  • ✅ Fall back to filename-based categorization

  • ✅ Log everything

  • ✅ Avoid crashes completely



Even if the file extension lies.



Doesn’t matter if it’s .txt, .md, or .conf.



Binary is binary.



No more surprise explosions.







😩 3. Windows Filename Rage



Previously, if someone tried to rename a file using invalid Windows characters…



They got a boring, unhelpful error.



Now?



We explain exactly what Windows hates:




Windows does not allow these characters in filenames:
\ (backslash) / (forward slash) : (colon)
* (asterisk) ? (question mark) " (quote)
< (less than) > (greater than) | (pipe)






Plus a clear:




Please remove these characters and try again.




Simple change.



Massive UX improvement.



No more guessing what went wrong.









🕰️ 4. The Undo Operation That Could Have Been Dangerous



Undo is supposed to feel magical.



But under the hood, it’s risky.



What if:




  • The moved file was deleted?

  • The original location now has a new file?

  • Something changed between operations?



Previously, this could cause crashes or accidental overwrites.



Now?



We check everything.



Before undoing:




  • ✅ Does the moved file still exist?

  • ✅ Is the original location free?



If not?



We stop and clearly explain why:




Cannot undo: Original location is already occupied.
A file already exists at: ...
Please manually verify and move the file if needed.






No corruption.

No overwriting.

No chaos.



This one was a critical-level fix.









📊 Before vs After






Before




  • Empty files behaved weirdly

  • Binary files could crash extraction

  • Error messages were vague

  • Undo could break in edge cases






After




  • Empty files detected and logged

  • Binary files safely skipped

  • Clear, human-readable error messages

  • Undo operations protected and safe



It feels like the app matured overnight.









💡 What This Really Is



This wasn’t a “new feature” release.



This was a stability hardening phase.



The kind of work users never see.



But they feel it.



Because the app stops:




  • Crashing randomly

  • Acting unpredictably

  • Failing silently



Instead, it behaves like a professional desktop application.









🚀 Final Thought



The difference between a prototype and a production-ready app?



Not fancy AI.

Not cool UI.



It’s this:




Handling weird, messy, real-world input gracefully.




Users will always find edge cases.



Your job is to make sure they don’t break everything when they do.



Sortify is now much harder to break.



And honestly?



That feels better than shipping a new feature. 💙

Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten 🧨 The Bugs That Almost Broke Sortify (And How I Crushed Them)

Thematisch verwandte Begriffe: Bugs, That, Almost, Broke · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

💬 Kommentare werden geladen…
Zum Aktualisieren ziehen
tsecurity.de Icon
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag