Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Model: make string attribute value auto-trimming optional #97

Merged
merged 3 commits into from
Jul 15, 2022

Conversation

lex0r
Copy link
Contributor

@lex0r lex0r commented Jul 14, 2022

because not all attributes are made equal.

because not all attributes are made equal.
@LukeTowers
Copy link
Member

@lex0r can you add the test case from the original PR? https://github.com/octobercms/library/pull/503/files#diff-270f442232291e973d322f9166dda6fb544ad2325f6db11581f7d553171213a8

Also I'm curious to know your use case and what problems auto trimming was causing for you, are you able to share some details?

src/Database/Model.php Outdated Show resolved Hide resolved
src/Database/Model.php Outdated Show resolved Hide resolved
@LukeTowers LukeTowers merged commit f9afe27 into wintercms:develop Jul 15, 2022
LukeTowers added a commit that referenced this pull request Jul 15, 2022
* develop:
  Apply fix from 1.0
  Add test case for trimStringAttributes flag
  Make string attribute value auto-trimming optional (#97)

# Conflicts:
#	src/Database/Attach/File.php
LukeTowers added a commit that referenced this pull request Jul 15, 2022
* develop:
  Apply fix from 1.0
  Add test case for trimStringAttributes flag
  Make string attribute value auto-trimming optional (#97)
  Added additional test case for UrlGenerator class (#90)
  Improve port validation when building URLs
  Avoid issues coming from double encoded URLs
  remove non-existent argument to Ini::parse() method (#82)
  Fix docblock typehint (#71)
  Code quality and windows test fix
  Improve Halcyon SectionParser logic
@RomainMazB
Copy link
Contributor

@lex0r can you add the test case from the original PR? https://github.com/octobercms/library/pull/503/files#diff-270f442232291e973d322f9166dda6fb544ad2325f6db11581f7d553171213a8

Also I'm curious to know your use case and what problems auto trimming was causing for you, are you able to share some details?

Great addition here!!

As I remember, my use case was forum messages including markdown: if you start a message with a code block using tab instead of three backticks, the tabs was trimmed and the code block just didn't work...

@lex0r
Copy link
Contributor Author

lex0r commented Jul 28, 2022

@lex0r can you add the test case from the original PR? https://github.com/octobercms/library/pull/503/files#diff-270f442232291e973d322f9166dda6fb544ad2325f6db11581f7d553171213a8

Also I'm curious to know your use case and what problems auto trimming was causing for you, are you able to share some details?

@LukeTowers I had to save a file to a remote location directly without any pre-processing and then save a record linking to it in the database. The file name can contain trailing spaces and that is acceptable, however when trying to save such a name in the database you would get the name trimmed. Later on we used the name to construct a link to the file and potential spaces were not included in that link which made it impossible to locate the file in the remote storage which has the file saved with the space.

@LukeTowers
Copy link
Member

Interesting, thanks for sharing your use case @lex0r!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants