Merge pull request #15866 from nextcloud/versionid-string
allow non integer version ids
This commit is contained in:
commit
f349d5a225
6 changed files with 10 additions and 10 deletions
|
@ -95,7 +95,7 @@ class PreviewController extends Controller {
|
|||
$user = $this->userSession->getUser();
|
||||
$userFolder = $this->rootFolder->getUserFolder($user->getUID());
|
||||
$file = $userFolder->get($file);
|
||||
$versionFile = $this->versionManager->getVersionFile($user, $file, (int)$version);
|
||||
$versionFile = $this->versionManager->getVersionFile($user, $file, $version);
|
||||
$preview = $this->previewManager->getPreview($versionFile, $x, $y, true, IPreview::MODE_FILL, $versionFile->getMimetype());
|
||||
return new FileDisplayResponse($preview, Http::STATUS_OK, ['Content-Type' => $preview->getMimeType()]);
|
||||
} catch (NotFoundException $e) {
|
||||
|
|
|
@ -46,10 +46,10 @@ interface IVersion {
|
|||
/**
|
||||
* Get the id of the revision for the file
|
||||
*
|
||||
* @return int
|
||||
* @return int|string
|
||||
* @since 15.0.0
|
||||
*/
|
||||
public function getRevisionId(): int;
|
||||
public function getRevisionId();
|
||||
|
||||
/**
|
||||
* Get the timestamp this version was created
|
||||
|
|
|
@ -85,9 +85,9 @@ interface IVersionBackend {
|
|||
*
|
||||
* @param IUser $user
|
||||
* @param FileInfo $sourceFile
|
||||
* @param int $revision
|
||||
* @param int|string $revision
|
||||
* @return ISimpleFile
|
||||
* @since 15.0.0
|
||||
*/
|
||||
public function getVersionFile(IUser $user, FileInfo $sourceFile, int $revision): File;
|
||||
public function getVersionFile(IUser $user, FileInfo $sourceFile, $revision): File;
|
||||
}
|
||||
|
|
|
@ -113,7 +113,7 @@ class LegacyVersionsBackend implements IVersionBackend {
|
|||
return $file->fopen('r');
|
||||
}
|
||||
|
||||
public function getVersionFile(IUser $user, FileInfo $sourceFile, int $revision): File {
|
||||
public function getVersionFile(IUser $user, FileInfo $sourceFile, $revision): File {
|
||||
$userFolder = $this->rootFolder->getUserFolder($user->getUID());
|
||||
$versionFolder = $this->getVersionFolder($user);
|
||||
/** @var File $file */
|
||||
|
|
|
@ -29,7 +29,7 @@ class Version implements IVersion {
|
|||
/** @var int */
|
||||
private $timestamp;
|
||||
|
||||
/** @var int */
|
||||
/** @var int|string */
|
||||
private $revisionId;
|
||||
|
||||
/** @var string */
|
||||
|
@ -55,7 +55,7 @@ class Version implements IVersion {
|
|||
|
||||
public function __construct(
|
||||
int $timestamp,
|
||||
int $revisionId,
|
||||
$revisionId,
|
||||
string $name,
|
||||
int $size,
|
||||
string $mimetype,
|
||||
|
@ -83,7 +83,7 @@ class Version implements IVersion {
|
|||
return $this->sourceFileInfo;
|
||||
}
|
||||
|
||||
public function getRevisionId(): int {
|
||||
public function getRevisionId() {
|
||||
return $this->revisionId;
|
||||
}
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ class VersionManager implements IVersionManager {
|
|||
return $backend->read($version);
|
||||
}
|
||||
|
||||
public function getVersionFile(IUser $user, FileInfo $sourceFile, int $revision): File {
|
||||
public function getVersionFile(IUser $user, FileInfo $sourceFile, $revision): File {
|
||||
$backend = $this->getBackendForStorage($sourceFile->getStorage());
|
||||
return $backend->getVersionFile($user, $sourceFile, $revision);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue