Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 294630

Cannot save translated nodes after upgrading to 8.8 due to invalid path

$
0
0

Problem/Motivation

Hm. Perhaps I'm doing sth. wrong, but after upgrading a few sites to Drupal 8.8 I found that I cannot save newly translated nodes anymore. The error message is "Either the path '/node/[nid]' is invalid or you do not have access to it." where [nid] is of course the corresponding NID.

I found that this error comes from "ValidPathConstraintValidator::validate". If I insert a return statement in the first line of that method, everything works as expected.

I don't have pathauto installed or sth. I *would* like to set/assign an automatic alias in a custom hook_node_presave, but the validation error seems to be trigged before this hook is even called. I checked pathauto and they are also using that hook to do their auto-path magic.

I don't understand the error message to be honest. Yes "/node/123" is of course not a valid alias, because it's reserved for the nodes. But I didn't assign anything. I don't even have permissions to assign any manual alias.

It used to work with 8.7 but not with 8.8.

Steps to reproduce

  1. Use sth. other than the administrator account. You should have the usual editor permissions to create nodes and create/update translations and translate any entity, of course. You should not have any url alias permissions.
  2. Create a new node in the original language (in my case: German)
  3. Save the node
  4. Edit the node again
  5. Click on translation, add translation (English)
  6. Site interface of translation form should be now in target (English) language (e.g. path /en/node/123/translations/add/de/en)
  7. Try to save

=> Error.

Proposed resolution

The current solution is for the PathWidget to set a form error only if the field is accessible by the user. The third option.

There have been 3 suggested solutions based on where the problem is.

  1. 1) The problem is the node_access table. Option 1 is to modify the database by adding a "nid=0" record in node_access, #15.
  2. 2) The problem is the alias field that is being defaulted to the original alias when creating a new translation. Leave that empty, #20 Reported to worķ. #21, #23, #24, #26, #27, #28, #46 and Reported to not work; #44, #45
  3. 3) The problem is that Drupal\path\Plugin\Field\FieldWidget\PathWidget::validateFormElement() sets the form error even if the field is not accessible by user while it should not. #79. Reported to work #83, #85

Note that In #30, the problem was not reproducible with core only. The suggestion is that access control modules are causing the problem. See #30, #31

Remaining tasks

Reply to feedback in #88
Review
Commit

User interface changes

API changes

Data model changes

N/A

Release notes snippet


Viewing all articles
Browse latest Browse all 294630

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>