Last modified: 2011-06-05 19:39:57 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 T30002, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 28002 - Internal error in ApiFormatRaw::getMimeType
Internal error in ApiFormatRaw::getMimeType
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
API (Other open bugs)
1.18.x
All All
: Normal minor (vote)
: ---
Assigned To: Roan Kattouw
http://en.wikipedia.org/w/api.php?act...
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-03-12 10:54 UTC by Jarry1250
Modified: 2011-06-05 19:39 UTC (History)
4 users (show)

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


Attachments

Description Jarry1250 2011-03-12 10:54:40 UTC
Error:  Exception Caught: Internal error in ApiFormatRaw::getMimeType: No MIME type set for raw formatter
Page: http://en.wikipedia.org/w/api.php?action=query&title=Main%20page&export&exportnowrap

I was messing around with the API, when I got this error. The the fact that the query is non-functional is almost certainly the result of me throwing it a nonsensical combination of inputs, but even so, the API should probably fail more gracefully.

Regards.
Comment 1 Sam Reed (reedy) 2011-03-12 12:31:53 UTC
Personally, I'm not sure it's something that is needed to fail more gracefully, or at least, not where the error is coming from

		if ( !isset( $data['mime'] ) ) {
			ApiBase::dieDebug( __METHOD__, 'No MIME type set for raw formatter' );
		}

That looks sane. If the set of options you are providing are indeed rubbish (ie no output should be given for them), then that does want looking at and potentially protecting against.
Comment 2 Sam Reed (reedy) 2011-03-12 12:34:55 UTC
http://en.wikipedia.org/w/api.php?action=query&titles=Main%20page&export&exportnowrap

title --> titles make it play nicely

Looks like ApiQuery isn't checking for existence of at least 1 of the following titles/pageids/revids
Comment 3 Sam Reed (reedy) 2011-03-12 12:54:25 UTC
Bleh, ApiPageSet

		// Only one of the titles/pageids/revids is allowed at the same time
		$dataSource = null;
		if ( isset( $params['titles'] ) ) {
			$dataSource = 'titles';
		}
		if ( isset( $params['pageids'] ) ) {
			if ( isset( $dataSource ) ) {
				$this->dieUsage( "Cannot use 'pageids' at the same time as '$dataSource'", 'multisource' );
			}
			$dataSource = 'pageids';
		}
		if ( isset( $params['revids'] ) ) {
			if ( isset( $dataSource ) ) {
				$this->dieUsage( "Cannot use 'revids' at the same time as '$dataSource'", 'multisource' );
			}
			$dataSource = 'revids';
		}

And then

		switch ( $dataSource ) {
//snip
			default:
				// Do nothing - some queries do not need any of the data sources.
				break;
		}

So we need a way to track for the export if we haven't specified a title when we needed to...

Though, it does do

		// only export when there are titles
		if ( !count( $exportTitles ) ) {
			return;
		}


It probably should just fail/do more like what http://en.wikipedia.org/w/api.php?action=query&title=Main%20page&export does, giving "<api />"
Comment 5 Sam Reed (reedy) 2011-06-05 19:23:05 UTC
r89523

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


Navigation
Links