statamic / v2-hub

Statamic 2 - Feature Requests and Bug Reports
https://statamic.com
95 stars 5 forks source link

Regression: Content with an underscore somewhere in the filename no longer works properly #2470

Open rivercreative opened 4 years ago

rivercreative commented 4 years ago

Describe the bug I have a lot of content imported from an external API with filenames in the format: {date}.{7-digit-ID}_{slugified-title}.md which used to work just fine, but after updating to either 2.11.13 or 2.11.14 they are flagged as duplicate IDs and generate "can't be added to stache repo" errors in logs.

To Reproduce Not sure, create content with underscore in the name?

Expected behavior content files with names that do not start with underscores but contain one should be kept untouched and work as expected.

Screenshots

control-panel-duplicate-ids

file-list-terminal

Environment details (please complete the following information):

Additional context

jasonvarga commented 4 years ago

How are you importing them from the API?

rivercreative commented 4 years ago

We get a push with json-data to our addon endpoint where we map some fields then save the entry like this:

$slug = $release['guid'] . '_' . slugify($release['title']);

if (!EntryAPI::slugExists($slug, $handle)) {
  $factory = EntryAPI::create($slug);
  $entry = $factory->collection($handle)
    ->with($release)
    ->date($release['PublishDate'])
    ->get();
  if (!$entry->save()) {
    return false;
  }
}
rivercreative commented 4 years ago

What more info would you like me to provide?