Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Link objects are incorrectly serialized in Statocles Documents #522

Open
preaction opened this issue Nov 18, 2016 · 0 comments
Open

Link objects are incorrectly serialized in Statocles Documents #522

preaction opened this issue Nov 18, 2016 · 0 comments

Comments

@preaction
Copy link
Owner

When we take a bunch of Statocles::Link objects and serialize them in the markdown file, they appear like so:

---
links:
  canonical:
    - !!perl/hash:Statocles::Link
      href: http://blogs.perl.org/users/preaction/2016/11/beamemitter-v1004-released.html
---

YAML has a special syntax to serialize objects, the !!perl/<reftype>:<class> syntax. Instead of allowing this, we should serialize it into a plain hash or a simple string ourselves.

This happens when we run statocles blog post with the EDITOR variable set in our environment, type in our link and our post, and then quit our editor. Statocles loads the document we wrote (which inflates the Statocles::Link objects), adds the things it needs, generates the post slug and directory, and then re-writes the document back out. When it writes the document back out, it passes in the Statocles::Link objects directly to YAML, which creates the YAML-serialized !!perl/hash:Statocles::Link thing.

The routine that performs this serialization is Statocles::Store::_freeze_document. This routine is where this bug needs to be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant