Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Requirements:
<database>pgsql</database>
<lib>intl</lib>
<lib>mbstring</lib>
<nextcloud min-version="32" max-version="33" />
<nextcloud min-version="32" max-version="34" />
</dependencies>
<background-jobs>
<job>OCA\Bookmarks\BackgroundJobs\CrawlJob</job>
Expand Down
8 changes: 6 additions & 2 deletions lib/AugmentedTemplateResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

namespace OCA\Bookmarks;

use OC;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\IURLGenerator;

/**
* @template S of \OCP\AppFramework\Http::STATUS_*
Expand All @@ -17,9 +17,13 @@
* @template-extends TemplateResponse<S,H>
*/
class AugmentedTemplateResponse extends TemplateResponse {
public function render() {

Check failure on line 20 in lib/AugmentedTemplateResponse.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable33

InvalidNullableReturnType

lib/AugmentedTemplateResponse.php:20:18: InvalidNullableReturnType: The declared return type 'string' for OCA\Bookmarks\AugmentedTemplateResponse::render is not nullable, but 'null|string' contains null (see https://psalm.dev/144)

Check failure on line 20 in lib/AugmentedTemplateResponse.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable34

InvalidNullableReturnType

lib/AugmentedTemplateResponse.php:20:18: InvalidNullableReturnType: The declared return type 'string' for OCA\Bookmarks\AugmentedTemplateResponse::render is not nullable, but 'null|string' contains null (see https://psalm.dev/144)

Check failure on line 20 in lib/AugmentedTemplateResponse.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable32

InvalidNullableReturnType

lib/AugmentedTemplateResponse.php:20:18: InvalidNullableReturnType: The declared return type 'string' for OCA\Bookmarks\AugmentedTemplateResponse::render is not nullable, but 'null|string' contains null (see https://psalm.dev/144)
$return = parent::render();
preg_replace('/<link rel="manifest" href="(.*?)">/i', '<link rel="manifest" href="' . OC::$server->getURLGenerator()->linkToRouteAbsolute('bookmarks.web_view.manifest') . '">', $return);
$params = $this->getParams();
if (isset($params['url']) && $params['url'] instanceof IURLGenerator) {
$manifestUrl = $params['url']->linkToRouteAbsolute('bookmarks.web_view.manifest');
$return = preg_replace('/<link rel="manifest" href="(.*?)">/i', '<link rel="manifest" href="' . $manifestUrl . '">', $return);
}
return $return;

Check failure on line 27 in lib/AugmentedTemplateResponse.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable33

NullableReturnStatement

lib/AugmentedTemplateResponse.php:27:10: NullableReturnStatement: The declared return type 'string' for OCA\Bookmarks\AugmentedTemplateResponse::render is not nullable, but the function returns 'null|string' (see https://psalm.dev/139)

Check failure on line 27 in lib/AugmentedTemplateResponse.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable34

NullableReturnStatement

lib/AugmentedTemplateResponse.php:27:10: NullableReturnStatement: The declared return type 'string' for OCA\Bookmarks\AugmentedTemplateResponse::render is not nullable, but the function returns 'null|string' (see https://psalm.dev/139)

Check failure on line 27 in lib/AugmentedTemplateResponse.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable32

NullableReturnStatement

lib/AugmentedTemplateResponse.php:27:10: NullableReturnStatement: The declared return type 'string' for OCA\Bookmarks\AugmentedTemplateResponse::render is not nullable, but the function returns 'null|string' (see https://psalm.dev/139)
}
}
4 changes: 2 additions & 2 deletions lib/ExportResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@

namespace OCA\Bookmarks;

use OC;
use OC\HintException;
use OCA\Theming\ThemingDefaults;
use OCP\AppFramework\Http\Response;
use OCP\IDateTimeFormatter;
use OCP\IUserSession;

/**
* @psalm-template S of int
Expand All @@ -25,20 +25,20 @@
public function __construct($returnstring) {
parent::__construct();

$user = OC::$server->getUserSession()->getUser();
$user = \OCP\Server::get(IUserSession::class)->getUser();
if (is_null($user)) {
throw new HintException('User not logged in');

Check failure on line 30 in lib/ExportResponse.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable33

UndefinedClass

lib/ExportResponse.php:30:14: UndefinedClass: Class, interface or enum named OC\HintException does not exist (see https://psalm.dev/019)

Check failure on line 30 in lib/ExportResponse.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable34

UndefinedClass

lib/ExportResponse.php:30:14: UndefinedClass: Class, interface or enum named OC\HintException does not exist (see https://psalm.dev/019)

Check failure on line 30 in lib/ExportResponse.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable32

UndefinedClass

lib/ExportResponse.php:30:14: UndefinedClass: Class, interface or enum named OC\HintException does not exist (see https://psalm.dev/019)
}

$userName = $user->getDisplayName();
$themingDefaults = \OCP\Server::get(ThemingDefaults::class);

Check failure on line 34 in lib/ExportResponse.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable33

UndefinedClass

lib/ExportResponse.php:34:39: UndefinedClass: Class, interface or enum named OCA\Theming\ThemingDefaults does not exist (see https://psalm.dev/019)

Check failure on line 34 in lib/ExportResponse.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable34

UndefinedClass

lib/ExportResponse.php:34:39: UndefinedClass: Class, interface or enum named OCA\Theming\ThemingDefaults does not exist (see https://psalm.dev/019)

Check failure on line 34 in lib/ExportResponse.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable32

UndefinedClass

lib/ExportResponse.php:34:39: UndefinedClass: Class, interface or enum named OCA\Theming\ThemingDefaults does not exist (see https://psalm.dev/019)
$dateTime = \OCP\Server::get(IDateTimeFormatter::class);
$productName = $themingDefaults->getName();

$export_name = '"' . $productName . ' Bookmarks (' . $userName . ') (' . $dateTime->formatDate(time()) . ').html"';
$this->addHeader('Cache-Control', 'private');
$this->addHeader('Content-Type', ' application/stream');
$this->addHeader('Content-Length', strlen($returnstring));

Check failure on line 41 in lib/ExportResponse.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable33

InvalidArgument

lib/ExportResponse.php:41:38: InvalidArgument: Argument 2 of OCA\Bookmarks\ExportResponse::addHeader expects string, but int<0, max> provided (see https://psalm.dev/004)

Check failure on line 41 in lib/ExportResponse.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable34

InvalidArgument

lib/ExportResponse.php:41:38: InvalidArgument: Argument 2 of OCA\Bookmarks\ExportResponse::addHeader expects string, but int<0, max> provided (see https://psalm.dev/004)

Check failure on line 41 in lib/ExportResponse.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable32

InvalidArgument

lib/ExportResponse.php:41:38: InvalidArgument: Argument 2 of OCA\Bookmarks\ExportResponse::addHeader expects string, but int<0, max> provided (see https://psalm.dev/004)
$this->addHeader('Content-Disposition', 'attachment; filename=' . $export_name);
$this->returnstring = $returnstring;
}
Expand Down
Loading