Fix bad URL encoding in .svg

preferencesAboutTextFull
Craig Watson 9 years ago
parent 82e5f92ca6
commit c220bf470f
  1. 13
      src/adaptors/UBSvgSubsetAdaptor.cpp

@ -1983,10 +1983,7 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::audioItemToLinkedAudio(UBGraphicsMed
mXmlWriter.writeAttribute(UBSettings::uniboardDocumentNamespaceUri, "position", QString("%1").arg(pos)); mXmlWriter.writeAttribute(UBSettings::uniboardDocumentNamespaceUri, "position", QString("%1").arg(pos));
} }
QString audioFileHref = audioItem->mediaFileUrl().toString(); QString audioFileHref = "audios/" + audioItem->mediaFileUrl().fileName();
audioFileHref = UBFileSystemUtils::removeLocalFilePrefix(audioFileHref);
if(audioFileHref.startsWith(mDocumentPath))
audioFileHref = audioFileHref.replace(mDocumentPath + "/","");
mXmlWriter.writeAttribute(nsXLink, "href", audioFileHref); mXmlWriter.writeAttribute(nsXLink, "href", audioFileHref);
mXmlWriter.writeEndElement(); mXmlWriter.writeEndElement();
@ -2225,7 +2222,7 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::graphicsItemToSvg(QGraphicsItem* ite
QUrl sourceUrl = ubItem->sourceUrl(); QUrl sourceUrl = ubItem->sourceUrl();
if (!sourceUrl.isEmpty()) if (!sourceUrl.isEmpty())
mXmlWriter.writeAttribute(UBSettings::uniboardDocumentNamespaceUri, "source", sourceUrl.toString()); mXmlWriter.writeAttribute(UBSettings::uniboardDocumentNamespaceUri, "source", sourceUrl.path());
} }
@ -2285,8 +2282,10 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::graphicsWidgetToSvg(UBGraphicsWidget
widgetRootUrl = widgetTargetDir; widgetRootUrl = widgetTargetDir;
} }
QString widgetPath = "widgets/" + widgetRootUrl.fileName();
mXmlWriter.writeStartElement("foreignObject"); mXmlWriter.writeStartElement("foreignObject");
mXmlWriter.writeAttribute(UBSettings::uniboardDocumentNamespaceUri, "src", widgetRootUrl.toString()); mXmlWriter.writeAttribute(UBSettings::uniboardDocumentNamespaceUri, "src", widgetPath);
graphicsItemToSvg(item); graphicsItemToSvg(item);
@ -2307,6 +2306,8 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::graphicsWidgetToSvg(UBGraphicsWidget
else else
startFileUrl = widgetRootUrl.toString() + "/" + item->mainHtmlFileName(); startFileUrl = widgetRootUrl.toString() + "/" + item->mainHtmlFileName();
startFileUrl = QUrl::fromPercentEncoding(startFileUrl.toUtf8());
mXmlWriter.writeAttribute("src", startFileUrl); mXmlWriter.writeAttribute("src", startFileUrl);
mXmlWriter.writeEndElement(); //iFrame mXmlWriter.writeEndElement(); //iFrame

Loading…
Cancel
Save