Last modified: 2013-10-06 19:09:59 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T53881, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 51881 - zimlib reports an unknown MIME type 65535 error for all articles with a redirect.
zimlib reports an unknown MIME type 65535 error for all articles with a redir...
Status: RESOLVED FIXED
Product: openZIM
Classification: Unclassified
zimlib (Other open bugs)
unspecified
All All
: Unprioritized critical
: ---
Assigned To: Tommi Mäkitalo
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-07-23 14:14 UTC by Kiran Mathew Koshy
Modified: 2013-10-06 19:09 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Kiran Mathew Koshy 2013-07-23 14:14:12 UTC
In all zim files, all articles that have a redirect are given the MIME type code of 65535. The problem is, whenever getMimeType() or getPage() is called in zimlib for an article that has a redirect, zimlib throws an "unknown MIME type 65535" error.
Comment 1 Tommi Mäkitalo 2013-07-25 20:22:55 UTC
It works as expected. The mime type is explicitly set to std::numeric_limits<uint16_t>::max() in redirects. See include/zim/dirent.h line 104.

Users should not call getMimeType or getPage on redirects but use isRedirect first to check weather the article is actually a redirect. The methods getMimeType and getPage do not actually make any sense on redirects.

A improvement would be to change the error message to something more useful but calling getMimeType or getPage on redirects should throw an exception.
Comment 2 Kiran Mathew Koshy 2013-07-25 20:36:39 UTC
Yes, but throwing an error for every redirect article doesn't gain anything. 
getMimeType() could return "redirect" and getPage() could return an empty string, and that way, a throw and catch could be avoided.
Comment 3 Tommi Mäkitalo 2013-07-25 20:40:47 UTC
A throw and catch could be avoided, if you just as for isRedirect first. It is just wrong to ask for a mime type or data from a redirect. "getMimeType()" should return a valid mime type and "redirect" is no mime type. Also a redirect has not empty page data. It has no page data at all since it does not make sense. It is just like in databases where there is a NULL value. It is an error if you ask for a value of a column, which do not have a value i.e. NULL.
Comment 4 Kiran Mathew Koshy 2013-07-25 20:44:26 UTC
Isn't it a little ironic that getLibraryMimeType() returns a 65535 without any error, but getMimeType() causes an error ?
Comment 5 Tommi Mäkitalo 2013-07-25 20:47:35 UTC
Ok - bug accepted - getLibraryMimeType should throw an exception also.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links