Visual content is crucial for any platform to grab attention. Recently, we noticed a peculiar issue with our posts: less than 12% of them included an image or video, despite our goal being 50%. This was surprising because our system was perfectly capable of adding images automatically, but it simply wasn't doing so, and nobody had noticed the shortfall. This situation highlighted a weakness not just in content delivery, but also in security.

Our old system allowed posts to link to *any* file path on the server. Imagine a simple error in one line of code accidentally publishing a personal photo, a confidential screenshot, or an internal product cover. Publishing, as you know, is irreversible! This was a significant risk that needed immediate removal.

To tackle these problems, we made two major changes. First, we introduced a new 'commit gate.' This gate rejects a queue of posts if it contains two text-only posts sitting next to each other. In other words, we've proactively forced the system to consider adding an image or video. This means you'll instantly see more visual content, making your browsing experience more engaging and enjoyable.

Second, we've vastly secured the rendering path for images and videos. Now, the *only* files that can ever be attached to a post are those our renderer produced, hashed, and securely committed. We've completely eliminated the risk of linking to arbitrary file paths.

To make things even safer, there's now one specific directory exclusively for post media: 'content/posts-media/'. When you want to add an image or video, the file *must* be located in this directory and referenced by its basename only (e.g., 'image.png' not 'some/path/image.png'). The system now includes multiple layers of verification: it rejects anything that isn't a bare filename (no sub-paths, no '..'), and the file extension must match its type (e.g., '.png' for images, '.mp4' for videos). Even after these checks, the system verifies a second time that the resulting absolute path still starts with the correct directory, preventing any clever manipulation attempts.

These changes aren't just technical improvements; they mean more engaging and secure content for you. You'll enjoy more images and videos, and you can rest assured that the content you see is trustworthy and safe, as we're protecting both your privacy and our data. It's a great example of how seemingly small technical adjustments can make a big difference in user experience and overall security.