Skip to content

Commit

Permalink
fix: Set default values for longtext columns in app logic
Browse files Browse the repository at this point in the history
Signed-off-by: Marcel Klehr <[email protected]>
  • Loading branch information
marcelklehr committed Oct 6, 2024
1 parent c6f15c1 commit 76f6d95
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/Db/Bookmark.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
* @package OCA\Bookmarks\Db
* @method string getUrl()
* @method setUrl(string $url)
* @method string getTitle()
* @method string getDescription()
* @method int getLastmodified()
* @method setLastmodified(int $lastmodified)
* @method int getAdded()
Expand Down Expand Up @@ -111,6 +109,10 @@ public function setTitle(string $title): void {
$this->setter('title', [$title]);
}

public function getTitle(): string {
return $this->title ?? '';
}

public function setDescription(string $desc): void {
// Cap title length at 1024 because the DB doesn't have more space currently (4096 byte with utf8mb4)
if (strlen($desc) > 1024) {
Expand All @@ -121,6 +123,10 @@ public function setDescription(string $desc): void {
$this->setter('description', [$desc]);
}

public function getDescription(): string {
return $this->title ?? '';
}

public function setTextContent(?string $content): void {
if ($content !== null) {
// Remove non-utf-8 characters from string: https://stackoverflow.com/questions/1401317/remove-non-utf8-characters-from-string
Expand Down

0 comments on commit 76f6d95

Please sign in to comment.