Skip to content

URI scheme: retrieve the file name for a zipped CellML file#391

Merged
agarny merged 4 commits intoopencor:mainfrom
agarny:issue390
Feb 4, 2026
Merged

URI scheme: retrieve the file name for a zipped CellML file#391
agarny merged 4 commits intoopencor:mainfrom
agarny:issue390

Conversation

@agarny
Copy link
Contributor

@agarny agarny commented Feb 4, 2026

Fixes #390.

Copilot AI review requested due to automatic review settings February 4, 2026 02:52
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses issue #390 by enhancing the URI scheme to display the actual file name for zipped CellML files instead of generic identifiers like "Data URL #xxx". For COMBINE archives, it now uses "OMEX #xxx" as a more descriptive identifier.

Changes:

  • Modified IDataUriInfo interface to include a fileName field for storing extracted file names from zipped CellML files
  • Updated filePath() and file() functions to accept a file name parameter and use it in the naming logic
  • Renamed variables from generic "dataUrl" prefixes to more specific "cellmlDataUrl" and "omexDataUrl" prefixes for clarity

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 12 comments.

File Description
src/renderer/src/common/locCommon.ts Added fileName field to IDataUriInfo interface; updated return statements in data URL processing functions; modified filePath and file functions to accept and use file name parameter
src/renderer/src/components/OpenCOR.vue Introduced separate tracking for CellML file names and OMEX counters; updated function calls to pass new parameters
package.json Version bump to 0.20260204.1
src/renderer/package.json Version bump to 0.20260204.1

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

}

dataUrlCounter = ++globalDataUrlCounter;
cellmlDataUrlFileName = zipCellmlDataUriInfo.fileName as string;
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using as string type assertion here is potentially unsafe. While the logic ensures that fileName should be defined when there's no error, TypeScript's type system indicates it's optional. Consider using optional chaining with a default value for better type safety: cellmlDataUrlFileName = zipCellmlDataUriInfo.fileName ?? ''; This makes the code more defensive against potential future changes in the zipCellmlDataUrl function.

Suggested change
cellmlDataUrlFileName = zipCellmlDataUriInfo.fileName as string;
cellmlDataUrlFileName = zipCellmlDataUriInfo.fileName ?? '';

Copilot uses AI. Check for mistakes.

dataUrlCounter = ++globalDataUrlCounter;
cellmlDataUrlFileName = zipCellmlDataUriInfo.fileName as string;
fileFilePathOrFileContents = zipCellmlDataUriInfo.data as Uint8Array;
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using as Uint8Array type assertion here is potentially unsafe. While the logic ensures that data should be defined when there's no error, TypeScript's type system indicates it's optional. Consider using a more defensive approach with optional chaining or an explicit check to ensure type safety and guard against potential future changes.

Copilot uses AI. Check for mistakes.
}

omexDataUrlCounter = ++globalOmexDataUrlCounter;
fileFilePathOrFileContents = combineArchiveDataUriInfo.data as Uint8Array;
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using as Uint8Array type assertion here is potentially unsafe. While the logic ensures that data should be defined when there's no error, TypeScript's type system indicates it's optional. Consider using a more defensive approach with optional chaining or an explicit check to ensure type safety and guard against potential future changes.

Suggested change
fileFilePathOrFileContents = combineArchiveDataUriInfo.data as Uint8Array;
if (!(combineArchiveDataUriInfo.data instanceof Uint8Array)) {
toast.add({
severity: 'error',
group: toastId.value,
summary: 'Opening a file',
detail: 'Unexpected COMBINE archive data format.',
life: TOAST_LIFE
});
return;
}
fileFilePathOrFileContents = combineArchiveDataUriInfo.data;

Copilot uses AI. Check for mistakes.
@agarny agarny merged commit 2173232 into opencor:main Feb 4, 2026
14 checks passed
@agarny agarny deleted the issue390 branch February 4, 2026 03:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

URI scheme: retrieve the file name for a zipped CellML file

1 participant