« form 的 enctype="multipart/form-data" 不是可以随便加的 | Main | links for 2008-12-26 »


fckeditor 0.8 插件在 Grails 1.0.4 中的bug

据说这个bug仅仅会在 Grails 1.0.4 中出现,有人建议直接使用 1.0.5 的预览版本,不过我看到 1.1 beta2 已经发布了,看来用不了再等多长的时间了。

修改文件 GRAILSAPP/plugins/fckeditor-0.8/grails-app/controllers/FckeditorController.groovy

在最后面,大概是 264 行附近开始,把如下一段:
def file = multiRequest.getFile("NewFile")
if (!file) {
errorNo = Fckeditor.ERROR_CUSTOM
errorMsg = "INVALID FILE"
}
else {
errorNo = Fckeditor.ERROR_NOERROR
newName = file.originalFilename

def f = splitFilename( newName )
if (isAllowed(f.ext, type)) {
def fileToSave = new File( finalDir, newName )
if ( !overwrite ) {
def idx = 1
while ( fileToSave.exists() ) {
errorNo = Fckeditor.ERROR_FILE_RENAMED
newName = "${f.name}(${idx}).${f.ext}"
fileToSave = new File( finalDir, newName )
idx++
}
}
file.transferTo( fileToSave )
}
else {
errorNo = Fckeditor.ERROR_INVALID_FILE_TYPE
errorMsg = "INVALID FILE TYPE"
}
}

替换为:

def file
if (ServletFileUpload.isMultipartContent(request)) {
FileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload upload = new ServletFileUpload(factory);
List /* FileItem */ items = upload.parseRequest(request);
file = items.find {
!it.isFormField() && 'NewFile' == it.fieldName
}
}
if(file) {
errorNo = Fckeditor.ERROR_NOERROR
newName = String.valueOf(System.currentTimeMillis())+'.'+FilenameUtils.getExtension(file.name)

def f = splitFilename( newName )
if (isAllowed(f.ext, type)) {
def fileToSave = new File( finalDir, newName )
if ( !overwrite ) {
def idx = 1
while ( fileToSave.exists() ) {
errorNo = Fckeditor.ERROR_FILE_RENAMED
newName = "${f.name}(${idx}).${f.ext}"
fileToSave = new File( finalDir, newName )
idx++
}
}
file.write( fileToSave )
}
else {
errorNo = Fckeditor.ERROR_INVALID_FILE_TYPE
errorMsg = "INVALID FILE TYPE"
}
} else {
errorNo = Fckeditor.ERROR_CUSTOM
errorMsg = "INVALID FILE"
}


Comments

I'm so happy to read this. This is the kind of manual that needs to be given and not the random misinformation that is at the other blogs. Appreciate your sharing this best doc.

WikiLeaks is an planetary new media non-profit social group that publishes submissions of otherwise unavailable documents from unknown news sources and news leaks. Its website, launched in 2006, is run by The Sunshine Press. Within a year of its launch, theinternet site claimed its information had grown to more than 1.2 million documents. The organisation has described itself as having been founded by Chinese dissidents, as well as journalists, mathematicians, and start-up company technologists from the United States government, Taiwan, EU, Australia, and South Africa. Julian Assange, an Australian Internet activist, is specificallydescribed as its supervisor.

Jolynn, I've seriously appreciated having your Special Report to guide me correct along step by step as I make my Squidoo Lens. I'd like to say thanks for taking your time to create and share this with us. Keep up the excellent get the job done! I are unable to wait until the sequel.

I had a lot of fun at Interface. They are extremely professional. I already had couple of calls and auditions!!!

Hi there. Very nice website!! Guy .. Excellent .. Amazing .. I will bookmark your site and take the feeds additionally...I'm happy to locate a lot of helpful info right here within the post. Thanks for sharing...

Hi there. Very cool website!! Man .. Beautiful .. Superb .. I'll bookmark your blog and take the feeds also...I am satisfied to find a lot of helpful information here in the post. Thanks for sharing..

I always was interested in this subject and still am, thanks for putting up.

I reckon something really special in this internet site.

I love your wordpress theme, where did you get a hold of it from?

You have ended approximately clothed points near. I checked proceeding the web to learn more concerning the deliver and found most inhabitants will chance next to with your views on this site.

I bring into being so a lot of motivating gear in your blog specially its discussion. As of the tons of comments by your articles, I suppose I am not the only one having all the enjoyment here! keep in the lead the clear work.

Really safe in order can be originate taking place web blog .

Hi! A big cheese in my Facebook congregate collective this site with us accordingly I came to check it out. I'm certainly loving the information. I'm bookmarking and will be real twittering this to my followers! Admirable blog and excessive design.

With all that window glass in that baby, I am confident among the occupants could be a fully functional "side check out mirror". Why mess with it up with somethin' that in all probability was not needed inside a vehicle like that? This can be my first chance to find out the Scarab lookin' like it just rolled from the assembly line. All I am able to say is task well carried out in her restoration, and kudos into the owners who appeared to own kept her as original as you can. Owing to the owners for your address to obtain to check out her!

You have brought up a very great points , thankyou for the post. "The great object is, that every man be armed. ... Every one who is able may have a gun." by Patrick Henry.

I dugg some of you post as I thought they were very useful invaluable|

Dead serene written pleased, merit for selective in rank. "The earth was ended cycle thus we would not spot very much consume the road." by Karen Blixen.

Hello, i really enjoy viewing your blog. I like the way its layd out, and totally dig the topic. Is there any way to subscribe to your site?

Hello, i really enjoy following your blog. I like the way its put together, and totally dig the topic. Is there any way to subscribe to your site?

yesss very thanks man i love this site

Hello, i really enjoy following your blog. I like the way its put together, and totally dig the topic. Is there any way to subscribe to your site?

The place was the individual responsible for roundin' all those voters up~?

Hello, i really enjoy visiting your blog. I like the way its written, and totally dig the design. Is there any way to subscribe to your site?

What was the price on the Bell rocket motor? Contact facts?

Thanks , I have recently been looking for info about this topic for ages and yours is the best I've discovered so far. But, what about the bottom line? Are you sure about the source?

whoah this blog is excellent i love reading your posts. Keep up the great work! You know, many people are hunting around for this information, you could aid them greatly.

I’m delighted that I had the opportunity to visit this blog and spread my horizons. However you ever thought that we at this time put our focus way to much on elements which just dont really matter, like my partner secretly surfing on Slightly Dressed Women Photography He is convinced i would certainly not really know it, but i do! But back to subject .. Right behind our back our governments conspiring for the next big world war, lowering our legal rights down, and throwing away our tax $. We must step back a little bit from unproductive internet sites and study more alterative news media like f.e. prisonplanet.com , naturalnews.com or infiniteunknown.net - I believe that We Are The People, and we ought to call for action and impose the change to the best of the people!

You need to be a part of a contest for one of the highest quality blogs on the web. I'm going to highly recommend this blog!

Love this website. Do you ever share this information on facebook?

Hello, i really like visiting your blog. I like the way its put together, and totally dig the concept. Is there any way to follow your site?

There will one day spring from the brain of science a machine or force so fearful in its potentialities, so absolutely terrifyin

I am glad to be one of several visitors on this great site (:, thank you for putting up.

I genuinely enjoy looking at on this website , it has got excellent posts .

Loving the info on this website , you have done great job on the posts .

What a lovely day for a 1961725! SCK was here

I have recently started a web site, the info you offer on this website has helped me greatly. Thanks for all of your time & work.

My husband, a war veteran, and I are EXTREMELY offended that the US Census chose to list "Hispanic" origin in a priority position on the questionaire, before all other races. First, if you're Hispanic, second...are you any other race.
We're mad as H*** about everything in this country being centered around Hispanics!!!!!!!!!!!! How about listing ALL races, in alphabetical order, or at the very least, prioritizing the American Indian in first place???
If this was a Mexico Census or Cuba Census, we would expect this question to be listed first. However, this is a US CENSUS why are Mexicans listed first???? We're sick of this racist and biased prioritizing covered under the blanket of "US Census".

Isn't it about time to move the denver Regional Office to Phoenix? Phoenix is by far the largest city in the region and much more of a dynamic metro center.

So good to know that the students will be counted in one or the other places. But "traditional fare like turkey and dressing"? to whom?

"wow, awesome post.Really planning to read more. Really Cool."

As soon as I found this site I went on reddit to share some of the love with them.

I am really appreciative for the post. Awesome.

Libby Houston~ Weve removed the ceiling above our dreams. There are no more impossible dreams.

Post a comment