Repository navigation
strip whitespace from the beginning and end of the display name - #11595
Conversation
|
@schiesbn did you test whether the search would work ? |
|
I don't know where the spaces come from. But this changes make the code more robust and ignore the white spaces... Of course I tested it and it works. |
|
So does it mean the search isn't using SQL queries at all ? |
|
I just strip the white spaces from the the beginning and the end of the display name. If the result is empty I return the UID, if not I return the display name. |
|
I know. But your change would not fix SQL queries that directly interact with the database field, if that field contains a single space. If you say the search does work with your fix, then it's fine. |
There was a problem hiding this comment.
to make it more robust, you check whether the returned value is a string. True (by hypothetical broken backend) would pass as well.
There was a problem hiding this comment.
good point, I will add it
|
For the search this doesn't make a difference. If you search for a user both a empty display name and a display name looking like " " won't match any real user name. The problem is that once we found a user by the uid, we should only return the display name as result if it contain "real" characters and not only white spaces. |
…oid empty display names
fb30cf0 to
239bff5
Compare
|
💣 Test FAILed. 💣 Build result: FAILUREGitHub pull request #11595 of commit 239bff5 automatically merged.Building remotely on vm-slave-02 (SLAVE) in workspace /var/jenkins/workspace/pull-request-analyser-ng-simple@13 > git rev-parse --is-inside-work-tree # timeout=10Fetching changes from the remote Git repository > git config remote.origin.url https://github.com/owncloud/core.git # timeout=10Fetching upstream changes from https://github.com/owncloud/core.git > git --version # timeout=10 > git fetch --tags --progress https://github.com/owncloud/core.git +refs/pull/:refs/remotes/origin/pr/ > git rev-parse origin/pr/11595/merge^{commit} # timeout=10Checking out Revision ba8f4131b5373435c75cff9decd487ef9763adf5 (detached) > git config core.sparsecheckout # timeout=10 > git checkout -f ba8f4131b5373435c75cff9decd487ef9763adf5 > git rev-list 4a99bf9a49077afbc888c6fcb5919cd9aee17b92 # timeout=10 > git remote # timeout=10 > git submodule init # timeout=10 > git submodule sync # timeout=10 > git config --get remote.origin.url # timeout=10 > git submodule update --init --recursiveTriggering pull-request-analyser-ng-simple » vm-slave-02Configuration pull-request-analyser-ng-simple » vm-slave-02 is still in the queue: Waiting for next available executor on vm-slave-02pull-request-analyser-ng-simple » vm-slave-02 completed with result FAILUREStarted calculate disk usage of buildFinished Calculation of disk usage of build in 0 secondsStarted calculate disk usage of workspaceFinished Calculation of disk usage of workspace in 3 second💣 Test FAILed. 💣 |
|
I tried setting the display names to " " directly in the database and the search worked with this fix. Code looks good, works 👍 |
|
@owncloud-bot retest this please |
|
The inspection completed: 5 new issues, 4 updated code elements |
|
🚀 Test PASSed. 🚀 |
|
second reviewer? @blizzz ? Thanks! |
|
Yepp, code looks good 👍 |
…bust strip whitespace from the beginning and end of the display name
|
@karlitschek backport? |
|
Yes please |
|
stable7: 6e3a7ea |
strip whitespace from the beginning and end of the display name to avoid empty display names
If a display name stored in the database contains whitespaces only we return the uid. Before we set a new display name we check if it contains real characters, not only whitespaces.
cc @blizzz @PVince81
fix #10817