Needs work
Project:
XML sitemap
Version:
2.x-dev
Component:
Other
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
7 Feb 2012 at 12:42 UTC
Updated:
16 Jan 2026 at 19:32 UTC
Jump to comment: Most recent
Some applications may have the need to have urls longer than 255 characters (although it's not a good idea).
If we configure an url field processed by xmlsitemap longer than 255 characters, on the form submit an SQL error is raised, breaking the submit flow.
Though long urls are not a good practice, could we rise the varchar column definition to something like varchar(1024)?
In any case I think the SQL error should be managed to at least not crash the admin.
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #1
Anonymous (not verified) commentedBased on what I've researched WRT this feature request I'm going to suggest that it be a text field instead of varchar. I found reference that IE 8 has a max of 4096 and I found reference to FF with a max of 2 GB.
Comment #2
czigor commentedComment #4
czigor commentedComment #5
czigor commentedTest failures are unrelated.
Comment #6
pfrenssenThis is interesting and yes I agree 255 characters will not be enough for all possible use cases.
I found a discussion about URL lengths on Stack Overflow: https://stackoverflow.com/questions/417142/what-is-the-maximum-length-of...
In short, it highly depends on the use case. In general there is some consensus in this discussion on using 2048 characters as a limit, but that's possibly outdated because this seems to have been mainly a limit of Internet Explorer. Some clients apparently can handle URLs up to 2GB, but that would be a tad excessive.
Comment #7
dave reidWhat does core's path module allow as the maxlength for aliases?
Comment #8
czigor commentedFrom
\Drupal\Core\Field\Plugin\Field\FieldType\UriItem:Comment #9
poker10 commentedThanks for working on this.
Path aliases seems to be varchar(256), but yes, URIs (and also menu URLs) seems to be varchar(2048). Can we use the same number as core then?
Also I think the
xmlsitemap_update_8004()is not correct for 2.x branch, which is compatible with D10 and D11. As per https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Extension... , we should probably use something likexmlsitemap_update_10201(). Thanks!Comment #10
poker10 commentedAlso to confirm: the two failures on Drupal core 11.3.x are unrelated to the patch (needs to be fixed in a separate issue). On 10.6.x pipeline is green.