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

Admin saving to _posts in root instead of custom collection folder collections_dir #703

Open
ADTC opened this issue May 14, 2023 · 1 comment

Comments

@ADTC
Copy link

ADTC commented May 14, 2023

Description:

When editing posts which have been moved to the custom collections directory, as defined by collections_dir in _config.yml Admin deletes the file in the custom_collection_dir/_posts folder and creates it in the _posts folder (in root).

Tell us a bit about yourself:

  • jekyll (4.3.2)
  • jekyll-admin (0.11.1)
  • Node v20.1.0
  • macOS Ventura M1
  • Firefox latest

Steps to reproduce:

  1. Add the configuration to _config.yml for custom collection folder.
  2. As per instruction, move the _posts folder in custom collection directory.
  3. Reload bundle exec jekyll serve
  4. Open admin and make any change in a post. Save the changes.
  5. Check the result in the file structure (done best if you have a Git repo tracking changes).

I expected the following:

Changes should be saved to the custom collection directory.

But got the following, instead:

Changes saved to a new file (in a subfolder) in root directory, with the file in custom collection directory deleted.

Other details:

Related: #449

@vcavallo
Copy link

vcavallo commented May 31, 2024

I'm running into this now as well. Oddly, it didn't happen for me until after I added additional collections and starting messing with default frontmatter. I can't tell what caused it to start.

It only happens on Edit. Creation of new items lands them where they're supposed to go.

This is a breaking bug for me

2024-05-31 13:33:59 - NoMethodError - undefined method `to_api' for nil:NilClass:
        /home/vcavallo/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/jekyll-admin-0.11.1/lib/jekyll-admin/server/collections.rb:37:in `block (2 levels) in <class:Server>'
        /home/vcavallo/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/sinatra-2.2.4/lib/sinatra/base.rb:1697:in `call'
        /home/vcavallo/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/sinatra-2.2.4/lib/sinatra/base.rb:1697:in `block in compile!'
        /home/vcavallo/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/sinatra-2.2.4/lib/sinatra/base.rb:1030:in `block (3 levels) in route!'
        /home/vcavallo/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/sinatra-2.2.4/lib/sinatra/base.rb:1049:in `route_eval'
        /home/vcavallo/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/sinatra-2.2.4/lib/sinatra/base.rb:1030:in `block (2 levels) in route!'
        /home/vcavallo/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/sinatra-2.2.4/lib/sinatra/base.rb:1078:in `block in process_route'
        /home/vcavallo/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/sinatra-2.2.4/lib/sinatra/base.rb:1076:in `catch'
        /home/vcavallo/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/sinatra-2.2.4/lib/sinatra/base.rb:1076:in `process_route'
        /home/vcavallo/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/sinatra-2.2.4/lib/sinatra/base.rb:1028:in `block in route!'
        /home/vcavallo/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/sinatra-2.2.4/lib/sinatra/base.rb:1025:in `each'
        /home/vcavallo/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/sinatra-2.2.4/lib/sinatra/base.rb:1025:in `route!'
        /home/vcavallo/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/sinatra-2.2.4/lib/sinatra/base.rb:1147:in `block in dispatch!'
        /home/vcavallo/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/sinatra-2.2.4/lib/sinatra/base.rb:1119:in `block in invoke'
        /home/vcavallo/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/sinatra-2.2.4/lib/sinatra/base.rb:1119:in `catch'
        /home/vcavallo/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/sinatra-2.2.4/lib/sinatra/base.rb:1119:in `invoke'
        /home/vcavallo/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/sinatra-2.2.4/lib/sinatra/base.rb:1142:in `dispatch!'
        /home/vcavallo/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/sinatra-2.2.4/lib/sinatra/base.rb:956:in `block in call!'
        /home/vcavallo/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/sinatra-2.2.4/lib/sinatra/base.rb:1119:in `block in invoke'
        /home/vcavallo/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/sinatra-2.2.4/lib/sinatra/base.rb:1119:in `catch'
        /home/vcavallo/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/sinatra-2.2.4/lib/sinatra/base.rb:1119:in `invoke'
        /home/vcavallo/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/sinatra-2.2.4/lib/sinatra/base.rb:956:in `call!'
        /home/vcavallo/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/sinatra-2.2.4/lib/sinatra/base.rb:945:in `call'
        /home/vcavallo/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/rack-protection-2.2.4/lib/rack/protection/xss_header.rb:18:in `call'
        /home/vcavallo/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/rack-protection-2.2.4/lib/rack/protection/path_traversal.rb:16:in `call'
        /home/vcavallo/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/rack-protection-2.2.4/lib/rack/protection/json_csrf.rb:26:in `call'
        /home/vcavallo/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/rack-protection-2.2.4/lib/rack/protection/base.rb:50:in `call'
        /home/vcavallo/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/rack-protection-2.2.4/lib/rack/protection/base.rb:50:in `call'
        /home/vcavallo/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/rack-protection-2.2.4/lib/rack/protection/frame_options.rb:31:in `call'
        /home/vcavallo/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/rack-2.2.9/lib/rack/null_logger.rb:11:in `call'
        /home/vcavallo/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/rack-2.2.9/lib/rack/head.rb:12:in `call'
        /home/vcavallo/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/sinatra-2.2.4/lib/sinatra/base.rb:218:in `call'
        /home/vcavallo/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/sinatra-2.2.4/lib/sinatra/base.rb:2004:in `call'
        /home/vcavallo/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/sinatra-2.2.4/lib/sinatra/base.rb:1564:in `block in call'
        /home/vcavallo/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/sinatra-2.2.4/lib/sinatra/base.rb:1780:in `synchronize'
        /home/vcavallo/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/sinatra-2.2.4/lib/sinatra/base.rb:1564:in `call'
        /home/vcavallo/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/rack-2.2.9/lib/rack/handler/webrick.rb:95:in `service'
        /home/vcavallo/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/webrick-1.8.1/lib/webrick/httpserver.rb:140:in `service'
        /home/vcavallo/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/webrick-1.8.1/lib/webrick/httpserver.rb:96:in `run'
        /home/vcavallo/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/webrick-1.8.1/lib/webrick/server.rb:310:in `block in start_thread'

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

No branches or pull requests

2 participants