RTFTranslator: don't accept translations with no RTF involved.
Fixes #11650. Thanks to TwoFx for investigating the issue.
This commit is contained in:
parent
e7cf3254ad
commit
0622135673
@ -166,6 +166,9 @@ RTFTranslator::Identify(BPositionIO *stream,
|
||||
status_t status = parser.Identify();
|
||||
|
||||
if (status == B_OK) {
|
||||
// Source data is RTF. We can translate to RTF (no-op), plaintext, or
|
||||
// styled text.
|
||||
|
||||
// return information about the data in the stream
|
||||
info->type = B_TRANSLATOR_TEXT; //RTF_TEXT_FORMAT;
|
||||
info->group = B_TRANSLATOR_TEXT;
|
||||
@ -175,6 +178,11 @@ RTFTranslator::Identify(BPositionIO *stream,
|
||||
sizeof(info->name));
|
||||
strcpy(info->MIME, "text/rtf");
|
||||
} else {
|
||||
// Not an RTF file. We can only work with it if we are translating to
|
||||
// RTF.
|
||||
if (outType != RTF_TEXT_FORMAT)
|
||||
return B_NO_TRANSLATOR;
|
||||
|
||||
stream->Seek(0, SEEK_SET);
|
||||
TranslatorStyledTextStreamHeader header;
|
||||
stream->Read(&header, sizeof(header));
|
||||
|
Loading…
x
Reference in New Issue
Block a user