Bug #45109

Editing the file content of a file marked as deleted result in exception

Added by Philipp Gampe over 2 years ago. Updated 7 months ago.

Status:Closed Start date:2013-02-03
Priority:Should have Due date:
Assigned To:- % Done:

0%

Category:File Abstraction Layer (FAL) Spent time: -
Target version:-
TYPO3 Version:6.0 Is Regression:No
PHP Version:5.3 Sprint Focus:
Complexity:

Description

If you set deleted=1 for a file in sys_file, then open the file for local editing, you cannot save the file any more:

First of all, files should not exist on the local file system and at the same time keep their deleted flag in DB.
Second, even if they are listed, you should not be able to edit them.
Third, the deleted flag should be reset if you save the file, because you do want them to exist.

Uncaught TYPO3 Exception
#1317178604: No file found for given UID. (More information)

InvalidArgumentException thrown in file
/home/phil/t3-playground/t3-git/typo3/sysext/core/Classes/Resource/ResourceFactory.php in line 262.

6 TYPO3\CMS\Core\Resource\ResourceFactory::getFileObject("13")

/home/phil/t3-playground/t3-git/typo3/sysext/core/Classes/Resource/ResourceFactory.php:
00315:    return $this->retrieveFileOrFolderObject($input);
00316:   } elseif (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($input)) {
00317:    return $this->getFileObject($input);
00318:   } elseif (strpos($input, ':') > 0) {
00319:    list($prefix, $folderIdentifier) = explode(':', $input);

5 TYPO3\CMS\Core\Resource\ResourceFactory::retrieveFileOrFolderObject("13")

/home/phil/t3-playground/t3-git/typo3/sysext/core/Classes/Utility/File/ExtendedFileUtility.php:
00442:   */
00443:  protected function getFileObject($identifier) {
00444:   $object = $this->fileFactory->retrieveFileOrFolderObject($identifier);
00445:   if (!is_object($object)) {
00446:    throw new \TYPO3\CMS\Core\Resource\Exception\InvalidFileException('The item ' . $identifier . ' was not a file or directory!!', 1320122453);

4 TYPO3\CMS\Core\Utility\File\ExtendedFileUtility::getFileObject("13")

/home/phil/t3-playground/t3-git/typo3/sysext/core/Classes/Utility/File/ExtendedFileUtility.php:
00742:   // for backwards compatibility: the combined file identifier was the path+filename
00743:   $fileIdentifier = $cmds['target'];
00744:   $fileObject = $this->getFileObject($fileIdentifier);
00745:   // Example indentifier for $cmds['target'] => "2:targetpath/targetfolder/" 
00746:   $content = $cmds['data'];

3 TYPO3\CMS\Core\Utility\File\ExtendedFileUtility::func_edit(array)

/home/phil/t3-playground/t3-git/typo3/sysext/core/Classes/Utility/File/ExtendedFileUtility.php:
00255:        break;
00256:       case 'editfile':
00257:        $result[$action][] = $this->func_edit($cmdArr);
00258:        break;
00259:       case 'upload':

2 TYPO3\CMS\Core\Utility\File\ExtendedFileUtility::processData()

/home/phil/t3-playground/t3-git/typo3/sysext/backend/Classes/Controller/File/FileController.php:
00128:   } else {
00129:    $this->fileProcessor->start($this->file);
00130:    $this->fileData = $this->fileProcessor->processData();
00131:   }
00132:  }

1 TYPO3\CMS\Backend\Controller\File\FileController::main()

/home/phil/t3-playground/t3-git/typo3/tce_file.php:
00040: $SOBE = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Controller\\File\\FileController');
00041: $SOBE->init();
00042: $SOBE->main();
00043: $SOBE->finish();
00044: ?>

Related issues

related to Core - Bug #42294: Missing action button to delete a file Rejected 2012-10-23
related to Core - Bug #44581: Editing file properties and pushing the delete button in ... Closed 2013-01-16
related to Core - Bug #50575: Fatal error while adding files to tt_content Closed 2013-07-30
related to Core - Bug #45110: File is listed twice in sys_file Closed 2013-02-03
blocked by Core - Task #45130: Reset deleted flag for existing files Closed 2013-02-04

History

#1 Updated by Max Roesch over 2 years ago

I can confirm this behaviour in 6.0.1

#2 Updated by Andreas Wolf over 2 years ago

IMHO this is mainly a UI bug. Editing a file should be forbidden when it is deleted, which has to be checked by the file edit module.

I'd like to split this into several issues, as we tackle totally different problems here.

#3 Updated by Philipp Gampe over 2 years ago

The UI has changed already so you can focus on fixing the code on unexpected conditions.

#45130 looks like it will solve most of this.

#4 Updated by Chris topher almost 2 years ago

  • Status changed from New to Needs Feedback
  • Is Regression set to No

The deleted flag has been removed in master, 6.1.5 and 6.0.10.

Does this fix the issue?

#5 Updated by Steffen Ritter over 1 year ago

  • Status changed from Needs Feedback to Accepted

#6 Updated by Steffen Ritter over 1 year ago

  • Status changed from Accepted to On Hold

#7 Updated by Mathias Schreiber 7 months ago

  • Status changed from On Hold to Closed

Also available in: Atom PDF