@multiplatform.one/platform 7.88.5 → 7.88.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@multiplatform.one/platform",
3
- "version": "7.88.5",
3
+ "version": "7.88.7",
4
4
  "description": "Platform detection flags and utilities for multiplatform.one",
5
5
  "keywords": [
6
6
  "detection",
@@ -56,7 +56,7 @@
56
56
  "@tamagui/constants": "2.7.6"
57
57
  },
58
58
  "devDependencies": {
59
- "@multiplatform.one/config": "7.88.5",
59
+ "@multiplatform.one/config": "7.88.7",
60
60
  "@tamagui/build": "2.7.6",
61
61
  "@types/chrome": "^0.3.5",
62
62
  "@types/firefox-webext-browser": "^143.0.1",
@@ -140,6 +140,23 @@ describe("native byte save (native boundary modeled)", () => {
140
140
  );
141
141
  });
142
142
 
143
+ it("counts a folder listed with trailing slashes as a taken name", async () => {
144
+ native.platform.isIos = true;
145
+ native.platform.isAndroid = false;
146
+ directory.uri = "file:///picked/";
147
+ const taken = ["file:///picked/Pokemon_report.csv", "file:///picked/Pokemon_report%202.csv//"];
148
+ Object.assign(directory, { list: vi.fn(() => taken.map((uri) => ({ uri }))) });
149
+ directory.createFile.mockImplementation((name: string) => {
150
+ file.uri = `file:///picked/${encodeURIComponent(name)}`;
151
+ file.name = "";
152
+ return file;
153
+ });
154
+ const { saveFile } = await api();
155
+ await expect(saveFile({ ...options(), filename: "Pokemon_report.csv" })).resolves.toMatchObject(
156
+ { filename: "Pokemon_report 3.csv" },
157
+ );
158
+ });
159
+
143
160
  it("omits an opaque Android document ID without reading it as a filename", async () => {
144
161
  file.uri = "content://example.documents/tree/root/document/42";
145
162
  const readName = vi.fn(() => "42");
@@ -87,7 +87,7 @@ export async function saveFile(options: FileSaveOptions): Promise<FileSaveResult
87
87
  }
88
88
 
89
89
  function lastSegment(uri: string): string {
90
- const segment = uri.replace(/\/+$/, "").split("/").pop() ?? "";
90
+ const segment = uri.split("/").filter(Boolean).pop() ?? "";
91
91
  try {
92
92
  return decodeURIComponent(segment);
93
93
  } catch {