[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kfm-devel
Subject:    \n before <html
From:       Stephan Goetter <sg17 () irz301 ! inf ! tu-dresden ! de>
Date:       1999-07-24 16:32:35
[Download RAW message or body]

Hi,

I try to fix a bug in KMimeMagic.cpp before kde-1.1.2.
I hope you can help me.

This is my test file.
--------
\n
<html><head>
</head><body></body></html>
--------

Because the first character is a newline, text/html is not recognized.
The newline would be "eaten up" (set to \0) in mconvert()
case STRING:
/* Null terminate and eat the return */
p->s[sizeof(p->s) - 1] = '\0';
if ((rt = strchr(p->s, '\n')) != NULL)
*rt = '\0';
return 1;

Because "\0<html" isn't the same like "<html" mcheck() fails :(
--------
\n
<html>
<head>
</head><body></body></html>
--------

This file works, not because match(), but in a method somewhere called from finishResults() or deeper,
text/html is set. Don't know why.

My problem is that a german TV-Channel (zdf) sends some files from www.zdf.msnbc.com over Intercast.
This files look like this:
--------
\r\n
<!--- H UP TEMPLATE--->\r\n
\r\n
<HTML><head>\r\n
.....
--------

Try to wget these files and rename them to .asm.htm .
http://www.zdf.msnbc.de/news/20388.asp
http://www.zdf.msnbc.de/news/20392.asp
http://www.zdf.msnbc.de/news/20410.asp
and now "file:/.../20388.asp.htm"

Some of these files were opened with kedit ()
, some in kfm and with some others kfm asks for an app.
Should this bug be fixed, or is it just buggy html ?

I think the "\n" and "\r\n" should be removed before calling mcheck().
Perhaps in mconvert() (really eaten up ?)
No data of type string in magic does contain any \r or \n,
so I think it's ok.

What do you think ?

BTW: The code in KMimeMagic is really a dirty hack. And the same code is in libkio (2.0) :(

Bye and Thanks,
Stephan

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic