SShortSingh.
Back to feed

go-pptx Edits Single Runs by Patching Raw Bytes to Preserve the Rest of the File

0
·7 views

A DEV Community post describes how the go-pptx library avoids the usual parse-modify-reserialize cycle when editing PowerPoint files. Conventional approaches can drop unknown vendor extensions, rewrite attribute order and namespace prefixes, and re-lay-out unrelated XML, which alters bytes and complicates signatures and audits. Instead, go-pptx treats the original raw bytes as the invariant and patches only the targeted region. This relies on the internal xmlstore package, a minimal scanner that tracks byte spans, namespace scopes, and element boundaries, and refuses non-UTF-8 input. Elements are identified by namespace URI and local name rather than prefix, and insertion operations are constrained to well-formed fragments.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

Four questions to ask before comparing cloud security platforms

Many security products claim to offer cloud security, but they often address different problems, such as network traffic, cloud configurations, or employee devices. The article recommends starting with four questions covering the network boundary, the application, cloud needs, and endpoints. It also suggests defining one critical situation, such as investigating a suspicious login, and testing which events are logged, what context is kept, and who can respond. Only products that address that specific scenario should be compared. The author notes that an unverified feature in a comparison guide does not necessarily mean a product lacks it, so vendor documentation should be checked.

0
ProgrammingDEV Community ·

Why Base64 Encoding Unicode Names Fails in Python, Node and the Browser

A developer building an email verification link found that a username with accented and Chinese characters produced garbled output and errors. The core issue is that Base64 operates only on bytes, so the string must first be converted using an explicit encoding such as UTF-8. Python 3.11 refuses to encode a str directly and forces the developer to choose an encoding, while Node 22's Buffer defaults to UTF-8 and yields identical results. The browser's btoa() function throws an InvalidCharacterError for characters outside the Latin-1 range, so UTF-8 bytes must be prepared before encoding. The article concludes that explicit UTF-8 handling on both ends keeps tokens portable across languages.

0
ProgrammingDEV Community ·

Developer Builds StoryForge AI, a Workspace for Long-Form Fiction Writing

A developer describes building StoryForge AI, a writing workspace aimed at novelists, web fiction writers, and independent authors. The project was motivated by the difficulty of managing whole books with AI, since chat windows struggle with chapter organization, context continuity, and revisions. The app follows a workflow from idea and outline to chapter generation, revision, manuscript assembly, and export to formats such as TXT. It is built with Next.js, Clerk for authentication, Supabase for data storage, and DeepSeek via an OpenAI-compatible interface, with AI requests handled server-side so API keys stay hidden. The author stresses that writers retain control over outlines, edits, and final decisions, treating AI output as draft material.