Skip to content

Commit 14eb856

Browse files
CopilotClaasRostock
andcommitted
Fix URI path parsing bug - correct file:// prefix stripping
Co-authored-by: ClaasRostock <48752696+ClaasRostock@users.noreply.github.com>
1 parent c490f4a commit 14eb856

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/mlfmu/fmu_build/templates/onnx_fmu/onnxFmu.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ OnnxFmu::OnnxFmu(cppfmu::FMIString fmuResourceLocation)
2525
* \brief Formats the onnx path.
2626
*
2727
* Formats the onnx path by appending the ONNX_FILENAME to the given fmuResourceLocation.
28-
* If the path starts with "file:///", it removes the "file://" prefix.
28+
* If the path starts with "file://", it removes the "file://" prefix.
2929
* This is directly stored to the class var onnxPath_.
3030
*
3131
* \param fmuResourceLocation The location of the FMU resource.
@@ -40,9 +40,9 @@ void OnnxFmu::formatOnnxPath(cppfmu::FMIString fmuResourceLocation)
4040

4141
// Remove file:// from the path if it is at the beginning
4242
std::wstring path = onnxPathStream.str();
43-
std::wstring startPath = path.substr(0, 8);
44-
std::wstring endPath = path.substr(8);
45-
if (startPath == L"file:///") {
43+
std::wstring startPath = path.substr(0, 7);
44+
std::wstring endPath = path.substr(7);
45+
if (startPath == L"file://") {
4646
path = endPath;
4747
}
4848
// save to onnxPath_ (wstring for Windows, else string)

0 commit comments

Comments
 (0)