Skip to content

Commit

Permalink
fix: code cleanups
Browse files Browse the repository at this point in the history
Signed-off-by: codewithvk <[email protected]>
  • Loading branch information
codewithvk committed Jan 30, 2025
1 parent a01da14 commit e7e3f09
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 7 deletions.
1 change: 0 additions & 1 deletion lib/Controller/DocumentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,6 @@ public function editOnlineTarget(int $fileId, ?string $target = null): RedirectR
#[PublicPage]
public function token(int $fileId, ?string $shareToken = null, ?string $path = null, ?string $guestName = null): DataResponse {
try {
// Normal file handling (unchanged)
$share = $shareToken ? $this->shareManager->getShareByToken($shareToken) : null;
$file = $shareToken ? $this->getFileForShare($share, $fileId, $path) : $this->getFileForUser($fileId, $path);

Expand Down
1 change: 0 additions & 1 deletion lib/Controller/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ public function demoServers(): DataResponse {
public function getSettings(): JSONResponse {
return new JSONResponse($this->getSettingsData());
}
// TODO : Provide Auth tokens here :)
private function getSettingsData(): array {
return [
'wopi_url' => $this->appConfig->getCollaboraUrlInternal(),
Expand Down
4 changes: 2 additions & 2 deletions lib/Controller/WopiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ public function __construct(
#[FrontpageRoute(verb: 'GET', url: 'wopi/files/{fileId}')]
public function checkFileInfo(string $fileId, string $access_token): JSONResponse {
try {
$wopi = $this->wopiMapper->getWopiForToken($access_token);

[$fileId, , $version] = Helper::parseFileId($fileId);

$wopi = $this->wopiMapper->getWopiForToken($access_token);
$file = $this->getFileForWopiToken($wopi);
if (!($file instanceof File)) {
throw new NotFoundException('No valid file found for ' . $fileId);
Expand Down
4 changes: 1 addition & 3 deletions lib/TokenManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,11 @@ public function __construct(
* @throws Exception
*/
public function generateWopiToken(string $fileId, ?string $shareToken = null, ?string $editoruid = null, bool $direct = false): Wopi {

[$fileId, , $version] = Helper::parseFileId($fileId);
$owneruid = null;
$hideDownload = false;
$rootFolder = $this->rootFolder;

[$fileId, , $version] = Helper::parseFileId($fileId);

// if the user is not logged-in do use the sharers storage
if ($shareToken !== null) {
/** @var File $file */
Expand Down

0 comments on commit e7e3f09

Please sign in to comment.