Skip to content

Conversation

@skjnldsv
Copy link
Member

@skjnldsv skjnldsv commented Jan 7, 2022

It now opens the folder directly
I think it's safer to use the shortened link as this is where we transform the final url. This is where we did all the changes in the past like

  • Open the sidebar straight away or not
  • Open the folder directly or not
  • Open the file main action directly or not
  • etc etc

@skjnldsv skjnldsv added bug 3. to review Waiting for reviews labels Jan 7, 2022
@skjnldsv skjnldsv added this to the Nextcloud 24 milestone Jan 7, 2022
@skjnldsv skjnldsv requested review from a team, artonge and icewind1991 January 7, 2022 11:41
@skjnldsv skjnldsv self-assigned this Jan 7, 2022
@skjnldsv skjnldsv requested review from ArtificialOwl and CarlSchwan and removed request for a team January 7, 2022 11:41
@skjnldsv
Copy link
Member Author

skjnldsv commented Jan 7, 2022

/backport to stable23

@skjnldsv
Copy link
Member Author

skjnldsv commented Jan 7, 2022

/backport to stable22

@skjnldsv
Copy link
Member Author

skjnldsv commented Jan 7, 2022

/backport to stable21

@ArtificialOwl
Copy link
Member

might be better to use this new link for folders only ?

@skjnldsv
Copy link
Member Author

skjnldsv commented Jan 7, 2022

might be better to use this new link for folders only ?

Well, it's the same, if we decide to change the url format, it means we'll also have to update this here too.
While if we keep using the /f/fileid shortcut, we make sure everything is at the same location

private function redirectToFile($fileId, bool $setOpenfile = false) {
$uid = $this->userSession->getUser()->getUID();
$baseFolder = $this->rootFolder->getUserFolder($uid);
$files = $baseFolder->getById($fileId);
$params = [];
if (empty($files) && $this->appManager->isEnabledForUser('files_trashbin')) {
$baseFolder = $this->rootFolder->get($uid . '/files_trashbin/files/');
$files = $baseFolder->getById($fileId);
$params['view'] = 'trashbin';
}
if (!empty($files)) {
$file = current($files);
if ($file instanceof Folder) {
// set the full path to enter the folder
$params['dir'] = $baseFolder->getRelativePath($file->getPath());
} else {
// set parent path as dir
$params['dir'] = $baseFolder->getRelativePath($file->getParent()->getPath());
// and scroll to the entry
$params['scrollto'] = $file->getName();
if ($setOpenfile) {
// forward the openfile URL parameter.
$params['openfile'] = $fileId;
}
}
return new RedirectResponse($this->urlGenerator->linkToRoute('files.view.index', $params));
}
throw new \OCP\Files\NotFoundException();
}

Copy link
Member

@PVince81 PVince81 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 makes sense

@skjnldsv skjnldsv merged commit 2c1eac6 into master Jan 14, 2022
@skjnldsv skjnldsv deleted the fix/search-url branch January 14, 2022 08:18
@skjnldsv skjnldsv added 4. to release Ready to be released and/or waiting for tests to finish and removed 3. to review Waiting for reviews labels Jan 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4. to release Ready to be released and/or waiting for tests to finish bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants