Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
onlyoffice_core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
onlyoffice_core
Commits
431115ef
Commit
431115ef
authored
Sep 12, 2017
by
Oleg Korshul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix open html file with incorrect extension
parent
206dd12a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
1 deletion
+39
-1
DesktopEditor/fontengine/application_generate_fonts_common.h
DesktopEditor/fontengine/application_generate_fonts_common.h
+11
-0
HtmlFile/HtmlFile.cpp
HtmlFile/HtmlFile.cpp
+28
-1
No files found.
DesktopEditor/fontengine/application_generate_fonts_common.h
View file @
431115ef
...
@@ -90,6 +90,17 @@ namespace NSCommon
...
@@ -90,6 +90,17 @@ namespace NSCommon
pStr
[
i
]
=
pStr
[
i
]
+
'A'
-
'a'
;
pStr
[
i
]
=
pStr
[
i
]
+
'A'
-
'a'
;
}
}
}
}
static
void
makeUpperW
(
std
::
wstring
&
url
)
{
int
nLen
=
(
int
)
url
.
length
();
wchar_t
*
pStr
=
(
wchar_t
*
)
url
.
c_str
();
for
(
int
i
=
0
;
i
<
nLen
;
++
i
)
{
if
(
pStr
[
i
]
>=
'a'
&&
pStr
[
i
]
<=
'z'
)
pStr
[
i
]
=
pStr
[
i
]
+
'A'
-
'a'
;
}
}
static
void
WriteLog
(
const
std
::
string
&
sLogFile
,
const
std
::
wstring
&
sData
)
static
void
WriteLog
(
const
std
::
string
&
sLogFile
,
const
std
::
wstring
&
sData
)
{
{
...
...
HtmlFile/HtmlFile.cpp
View file @
431115ef
...
@@ -35,6 +35,7 @@
...
@@ -35,6 +35,7 @@
#include "../DesktopEditor/common/StringBuilder.h"
#include "../DesktopEditor/common/StringBuilder.h"
#include "../DesktopEditor/common/String.h"
#include "../DesktopEditor/common/String.h"
#include "../DesktopEditor/xml/include/xmlutils.h"
#include "../DesktopEditor/xml/include/xmlutils.h"
#include "../DesktopEditor/fontengine/application_generate_fonts_common.h"
#include <vector>
#include <vector>
#include <map>
#include <map>
...
@@ -242,10 +243,30 @@ int CHtmlFile::Convert(const std::vector<std::wstring>& arFiles, const std::wstr
...
@@ -242,10 +243,30 @@ int CHtmlFile::Convert(const std::vector<std::wstring>& arFiles, const std::wstr
oBuilder
.
WriteString
(
L"</destination>"
);
oBuilder
.
WriteString
(
L"</destination>"
);
std
::
vector
<
std
::
wstring
>
arTmpFiles
;
for
(
std
::
vector
<
std
::
wstring
>::
const_iterator
iter
=
arFiles
.
begin
();
iter
!=
arFiles
.
end
();
iter
++
)
for
(
std
::
vector
<
std
::
wstring
>::
const_iterator
iter
=
arFiles
.
begin
();
iter
!=
arFiles
.
end
();
iter
++
)
{
{
oBuilder
.
WriteString
(
L"<file>"
);
oBuilder
.
WriteString
(
L"<file>"
);
oBuilder
.
WriteEncodeXmlString
(
CorrectHtmlPath
(
*
iter
));
std
::
wstring
sFilePath
=
*
iter
;
std
::
wstring
sExt
=
NSCommon
::
GetFileExtention
(
sFilePath
);
NSCommon
::
makeUpperW
(
sExt
);
if
(
sExt
==
L"HTML"
||
sExt
==
L"HTM"
)
oBuilder
.
WriteEncodeXmlString
(
CorrectHtmlPath
(
sFilePath
));
else
{
std
::
wstring
sTmpFile
=
NSFile
::
CFileBinary
::
CreateTempFileWithUniqueName
(
NSDirectory
::
GetTempPath
(),
L"HTM"
);
if
(
NSFile
::
CFileBinary
::
Exists
(
sTmpFile
))
NSFile
::
CFileBinary
::
Remove
(
sTmpFile
);
sTmpFile
=
sTmpFile
+
L".html"
;
NSFile
::
CFileBinary
::
Copy
(
sFilePath
,
sTmpFile
);
oBuilder
.
WriteEncodeXmlString
(
CorrectHtmlPath
(
sTmpFile
));
arTmpFiles
.
push_back
(
sTmpFile
);
}
oBuilder
.
WriteString
(
L"</file>"
);
oBuilder
.
WriteString
(
L"</file>"
);
}
}
...
@@ -411,6 +432,12 @@ int CHtmlFile::Convert(const std::vector<std::wstring>& arFiles, const std::wstr
...
@@ -411,6 +432,12 @@ int CHtmlFile::Convert(const std::vector<std::wstring>& arFiles, const std::wstr
}
}
#endif
#endif
for
(
std
::
vector
<
std
::
wstring
>::
iterator
i
=
arTmpFiles
.
begin
();
i
!=
arTmpFiles
.
end
();
i
++
)
{
NSFile
::
CFileBinary
::
Remove
(
*
i
);
}
arTmpFiles
.
clear
();
NSFile
::
CFileBinary
::
Remove
(
sTempFileForParams
);
NSFile
::
CFileBinary
::
Remove
(
sTempFileForParams
);
return
nReturnCode
;
return
nReturnCode
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment