Skip to content

Commit 502bda2

Browse files
authored
fix open online template location (texstudio-org#3534)
1 parent e042ab3 commit 502bda2

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/templateselector.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,17 @@ void TemplateSelector::removeTemplate()
629629
void TemplateSelector::openTemplateLocation()
630630
{
631631
TemplateHandle th = selectedTemplate();
632-
QString url = "file:///" + QFileInfo(th.file()).absolutePath();
632+
QString url = th.file();
633+
QString proto = url;
634+
proto.truncate(8);
635+
if (proto=="https://") {
636+
url.replace(0, QString( "https://raw.githubusercontent.com/texstudio-org/texstudio-template/main").size(),
637+
"https://github.com/texstudio-org/texstudio-template/tree/main");
638+
url.truncate(url.lastIndexOf("/"));
639+
}
640+
else {
641+
url = "file:///" + QFileInfo(th.file()).absolutePath();
642+
}
633643
if (!QDesktopServices::openUrl(QUrl(url))) {
634644
UtilsUi::txsCritical(tr("Could not open location:") + QString("\n%1").arg(url));
635645
}

0 commit comments

Comments
 (0)