Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

There was an error looking for new files


Reply


7 Posts   1162 Views

Avatar
Junglefish

Community Member, 109 Posts

8 August 2011 at 8:15pm

Hi
I just re-organised some document sub-directories beneath the \assets\ directory, then added a few more documents manually to those sub-directories.

When I hit the "Look for new files" button in order to re-synch the directories with the database I get a "There was an error looking for new files" error.

How do I figure out what's wrong?

jf/

Avatar
MarcusDalgren

Community Member, 288 Posts

8 August 2011 at 8:21pm

If you have firebug installed (in Firefox) I think it's an ajax request so whatever went wrong shows up in the console. Otherwise it's probably really hard to track.

Avatar
Junglefish

Community Member, 109 Posts

8 August 2011 at 8:29pm

Thanks Smurkas!

Firebug says there's an "Uncaught ValidationException". The full output is below.

I think it's saying it has encountered a file extension it doesn't like, but why would it then abort the entire mission? Is this a SS bug? Or do I simply need to track down the offending file?

jf/

ERROR [User Error]: Uncaught ValidationException: Validation error writing a File object: Extension is not allowed (valid: , ace, arc, arj, asf, au, avi, bmp, bz2, cab, cda, css, csv, dmg, doc, docx, flv, gif, gz, hqx, htm, html, ico, jar, jpeg, jpg, js, m4a, m4v, mid, midi, mkv, mov, mp3, mp4, mpa, mpeg, mpg, ogg, pages, pcx, pdf, pkg, png, pps, ppt, pptx, ra, ram, rm, rtf, sit, sitx, swf, tar, tgz, tif, tiff, txt, wav, wma, wmv, xhtml, xls, xlsx, xml, zip, zipx). Object not written.
IN POST /admin/assets/sync
Line 931 in C:\wamp\www\OlafIntranet\SilverStripe\sapphire\core\model\DataObject.php

Source
======
922:       $firstWrite = false;

923:       $this->brokenOnWrite = true;

924:       $isNewRecord = false;

925:       

926:       if(self::get_validation_enabled()) {

927:          $valid = $this->validate();

928:          if(!$valid->valid()) {

929:             // Used by DODs to clean up after themselves, eg, Versioned

930:             $this->extend('onAfterSkippedWrite');

* 931:             throw new ValidationException($valid, "Validation error writing a $this->class object: " .
$valid->message() . ". Object not written.", E_USER_WARNING);

932:             return false;

933:          }

934:       }

935:

936:       $this->onBeforeWrite();

937:       if($this->brokenOnWrite) {

Trace
=====
<ul>DataObject->write()
line 348 of Folder.php

Folder->resetFilename()
line 347 of Folder.php

Folder->resetFilename()
line 331 of File.php

File->setName(External Committees)
line 97 of ImageGalleryPage.php

ImageGalleryPage->checkFolder()
line 70 of ImageGalleryPage.php

ImageGalleryPage->onAfterWrite()
line 1056 of DataObject.php

DataObject->write()
line 136 of Filesystem.php

Filesystem::sync()
line 498 of AssetAdmin.php

AssetAdmin->sync(SS_HTTPRequest)
line 193 of Controller.php

Controller->handleAction(SS_HTTPRequest)
line 134 of RequestHandler.php

RequestHandler->handleRequest(SS_HTTPRequest)
line 147 of Controller.php

Controller->handleRequest(SS_HTTPRequest)
line 283 of Director.php

Director::handleRequest(SS_HTTPRequest,Session)
line 127 of Director.php

Director::direct(/admin/assets/sync)
line 127 of main.php

</ul>

Avatar
MarcusDalgren

Community Member, 288 Posts

8 August 2011 at 8:36pm

Yes one would hope that it would simply skip the offending file instead of throwing an exception.
What you can do is add the file type to the list of allowed files.

Just add for example:
File::$allowed_extensions[] = "eps"; // This would allow eps-files
in your _config.php and hopefully you shouldn't be getting exceptions anymore.

Avatar
Junglefish

Community Member, 109 Posts

8 August 2011 at 8:57pm

Hmm...

So I go looking for the offending file(s). I remove all the sub-directories completely then add them back one-by-one, hitting the "Look for new files" button each time. And guess what? No more errors! I managed to put all the sub-directories back, hit "Look for new files" one more time just to be sure, and the error is no longer there.

So, good news, I no longer have a problem!

But I am still left wondering what caused the initial problem. Some sort of database corruption maybe?

jf/

Avatar
MarcusDalgren

Community Member, 288 Posts

8 August 2011 at 9:04pm

I'm not sure. The error seems to be that you have a file somewhere with the wrong extension but since you're not getting that error anymore that can't be the case unless you didn't put all your files back or something. I never use that section of the CMS myself since it always causes me trouble. It's deleted files for me when pressing that button etc so for me it's never been worth the hassle. Also several times when I've gotten an error just pressing the button again has somehow "fixed" it.

Anyways if you get that error again then look through your files and see if you find one that's not on the list and in that casse add it like I showed you. If it's something else then we might have to go digging.

Avatar
_Vince

Community Member, 162 Posts

15 April 2013 at 10:43pm

2.4.7

I only seem to get the "extension not allowed" error when trying to rename the extension of a file while keeping the same file name.

If I try to rename a file from "AAABBBCCC.JPG" to "AAABBBCCC.jpg", then I am told that the extension is invalid. Even if "JPG|jpg" are mentioned in the .htaccess file.

If, however, I rename the file from "AAABBBCCC.JPG" to "sports.jpg" then that's all good.

Posting this in case it helps anyone.