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

Remove broken undraft command #4353

Closed
robertbasic opened this issue Jan 29, 2018 · 4 comments · Fixed by #4354
Closed

Remove broken undraft command #4353

robertbasic opened this issue Jan 29, 2018 · 4 comments · Fixed by #4354
Labels
Milestone

Comments

@robertbasic
Copy link
Contributor

Hello!

When trying to undraft content with hugo undraft content/blog/article.md Hugo will panic with the following:

panic: interface conversion: interface {} is time.Time, not string

goroutine 1 [running]:
github.com/gohugoio/hugo/commands.undraftContent(0x1f38160, 0xc4203af780, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/go/src/github.com/gohugoio/hugo/commands/undraft.go:113 +0xc1e
github.com/gohugoio/hugo/commands.Undraft(0x1f92020, 0xc4204bc9c0, 0x1, 0x1, 0x0, 0x0)
	/go/src/github.com/gohugoio/hugo/commands/undraft.go:65 +0x1f4
github.com/gohugoio/hugo/vendor/github.com/spf13/cobra.(*Command).execute(0x1f92020, 0xc4204bc910, 0x1, 0x1, 0x1f92020, 0xc4204bc910)
	/go/src/github.com/gohugoio/hugo/vendor/github.com/spf13/cobra/command.go:746 +0x475
github.com/gohugoio/hugo/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0x1f90520, 0xf25148, 0xe7ecab, 0x5)
	/go/src/github.com/gohugoio/hugo/vendor/github.com/spf13/cobra/command.go:831 +0x30e
github.com/gohugoio/hugo/commands.Execute()
	/go/src/github.com/gohugoio/hugo/commands/hugo.go:190 +0x60
main.main()
	/go/src/github.com/gohugoio/hugo/main.go:27 +0x36

This only happens when the frontmatter is in the following format (I believe toml):

+++
title = "Draft"
date = 2018-01-29T15:23:04+01:00
draft = true
+++

If the frontmatter is like in the markdown files found in the examples directory (I believe yaml):

---
title: "Draft"
date: 2018-01-29T15:23:04+01:00
draft: true
---

the undrafting goes through OK.

This happens for me with both 0.34, and latest master.

I will try and investigate a bit more, maybe I can submit a patch for this.

@bep
Copy link
Member

bep commented Jan 29, 2018

I think this "undraft" command was not such a good idea. We obviously needs tests for the commands package, but this is not the first time that this command is broken and needs fixing.

I suggest we just remove that command. It feels more natural to just edit the front matter with a text editor.

@bep bep changed the title Undrafting content panic Remove broken undraft command Jan 29, 2018
@robertbasic
Copy link
Contributor Author

@bep that's what I was doing originally, just change the draft to false while editing, but then I noticed that if I run hugo with hugo -ws . and I undraft a piece of content by "manual" editing, hugo doesn't pick up the newly undrafted content. Would you like me to open a new issue for that?

robertbasic added a commit to robertbasic/hugo that referenced this issue Jan 29, 2018
According to @bep, it is easier to undraft content by
editing manually the frontmatter of said content by
setting the draft flag to `false`, or removing it completely,
than to rely on the undraft command which is a source of
many bugs.

Fixes gohugoio#4353
@bep
Copy link
Member

bep commented Jan 29, 2018

Would you like me to open a new issue for that?

I suspect that is the "fast render mode" talking. There is a recent issue + PR about that.

@bep bep added this to the v0.35 milestone Jan 29, 2018
@bep bep closed this as completed in #4354 Jan 29, 2018
bep pushed a commit that referenced this issue Jan 29, 2018
According to @bep, it is easier to undraft content by
editing manually the frontmatter of said content by
setting the draft flag to `false`, or removing it completely,
than to rely on the undraft command which is a source of
many bugs.

Fixes #4353
@github-actions
Copy link

github-actions bot commented Mar 8, 2022

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants