The vulnerability lies in the ipynbSanitizer function in internal/app/api.go. This function was responsible for creating a policy to sanitize Jupyter Notebook files. The policy incorrectly allowed all data: URI schemes by using p.AllowURLSchemes("data"). This oversight permitted an attacker to embed malicious HTML and JavaScript within a data: URI (e.g., data:text/html,<script>alert(1)</script>). When the Gogs server processed a crafted .ipynb file, the sanitizer would fail to remove the malicious data: URI, leading to a stored Cross-Site Scripting (XSS) vulnerability. The fix, as seen in the commit dd1bd9837aa196b3ed3a8ee21e5727b5d7a986a3, was to replace the overly permissive rule with p.AllowURLSchemeWithCustomPolicy("data", markup.IsSafeDataURI), which restricts data: URIs to a whitelist of safe image MIME types, thus preventing the XSS attack.