At now 'source' field of Feed entity is limited to 255 symbols, that is too short for different URL's with many GET arguments.
Will be good to extend max ength of feed source url field at least to 2048 symbols: https://www.boutell.com/newfaq/misc/urllength.html

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Murz created an issue. See original summary.

MegaChriz’s picture

That sounds like a good idea. Do you want to create a patch for this? It could be that a database update is also needed, but I'm not sure about that. For some changes in database schema, Drupal automatically generates database updates.

Murz’s picture

I try to create the patch, seems the right place for extend field size is in file src/Entity/Feed.php at:

    $fields['source'] = BaseFieldDefinition::create('uri')
      ->setLabel(t('Source'))
      ->setDescription(t('The source of the feed.'))
      ->setRequired(TRUE)
      ->setDisplayOptions('view', [
        'label' => 'inline',
        'type' => 'feeds_uri_link',
        'weight' => -3,
      ])
      ->setDisplayConfigurable('view', TRUE);

but when I try to modify length via

      ->setSetting('max_length', 2048)

- nothing changes, even after clearing all caches.

Murz’s picture

I found the right place, simply adding #maxlength parameter to form item in src/Feeds/Fetcher/Form/HttpFetcherFeedForm.php solves the problem, without any database changes. Patch is attached.

But seems that we can extend URL length to larger values, because as described in https://www.boutell.com/newfaq/misc/urllength.html - 2048 is only Internet Explorer limit, other browsers support length up to 65,536 (Firefox) - 190,000 (Opera).

Murz’s picture

Status: Active » Needs review

  • MegaChriz committed 067800b on 8.x-3.x authored by Murz
    Issue #2979659 by Murz: Increased max length of feed source url from 255...
MegaChriz’s picture

Status: Needs review » Fixed

I checked the feeds_feed table and I see that the source column (where the URL is saved) already accepts 2048 characters. I saw in \Drupal\Core\Render\Element\Url that Drupal core sets an URL element by default to a max length of 255, so that's why there was that limit.

Thanks for the patch. Committed #4.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.