Data too long for column 'asset_url' at row 1 when inserting asset derivative into database

Description

When user has uploaded a new asset that consists of a really long name.

 

For example:

Gilkes Turbine No 490 with 30hp invented by Henry Watson, Lord Armstrong of Cragside and Gilkes, credit D Burton Feature Services Ltd.jpg.jpg

It then generates slug like this:

gilkes-turbine-no-490-with-30hp-invented-by-henry-watson-lord-armstrong-of-cragside-and-gilkes-credit-d-burton-feature-services-ltd

The slug is still less than 150 characters.

However, when the it merges with the website domain and etc, the asset url becomes a really long text.

For example:

https://www.helloworldabcd.org/uploads/assets/0d076178-887f-48be-8356b359dcbd2c23/slider_four_slides_b7d459565211f145cee61feb87639909/gilkes-turbine-no-490-with-30hp-invented-by-henry-watson-lord-armstrong-of-cragside-and-gilkes-credit-d-burton-feature-services-ltd.jpg

Environment

None

Activity

Show:
Choon Tat Thum
November 28, 2019, 3:17 AM

Pull request created

Seak Chiew Lee
April 24, 2020, 5:54 PM

This is an issue for asset_derivative as well where the asset URL is too long due to long file name. Especially when asset derivative url contains 2 sets of ID, the asset and the derivative ids.

I would suggest to remove the index of the asset url and create a new field to keep the hash of the asset URL and index the hash value instead. This will allow long asset url without the restriction od 255 characters. The changes needs to be implemented on both asset and asset derivative’s asset_url field.

Assignee

Unassigned

Reporter

Chun Weng Wong

Labels

None

Accepted

Yes

Fix versions

Affects versions

Priority

High
Configure