Skip to content

Commit

Permalink
Fix asset importing
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeDoctorDE committed Dec 13, 2024
1 parent 7d6192c commit 38878a7
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 59 deletions.
4 changes: 2 additions & 2 deletions api/lib/src/models/data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ final class NoteData extends ArchiveData<NoteData> {
(NoteData, String) importAsset(
String path, Uint8List data, String fileExtension) {
final hash = sha512256.convert(data);
final name = base64Encode(hash.bytes);
final newPath = '$path/${findUniqueName(path, fileExtension, name)}';
final name = hash.toString();
final newPath = '$path/$name.$fileExtension';
return (setAsset(newPath, data), newPath);
}

Expand Down
4 changes: 2 additions & 2 deletions api/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -587,10 +587,10 @@ packages:
dependency: transitive
description:
name: timing
sha256: "70a3b636575d4163c477e6de42f247a23b315ae20e86442bebe32d3cabf61c32"
sha256: "62ee18aca144e4a9f29d212f5a4c6a053be252b895ab14b5821996cff4ed90fe"
url: "https://pub.dev"
source: hosted
version: "1.0.1"
version: "1.0.2"
type_plus:
dependency: transitive
description:
Expand Down
8 changes: 1 addition & 7 deletions app/lib/handlers/import.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ class ImportHandler extends Handler<ImportTool> {
context.refresh();
}

@override
bool canChange(PointerDownEvent event, EventContext context) => false;

@override
Future<void> onPointerUp(PointerUpEvent event, EventContext context) async {
final state = context.getState();
Expand All @@ -58,12 +55,9 @@ class ImportHandler extends Handler<ImportTool> {
state.assetService,
state.page,
))
.map((e) => e.transform(position: _offset, relative: true)?.element)
.map((e) => e.transform(position: _offset, relative: true)?.element.copyWith(id: createUniqueId()))
.nonNulls
.toList()));
context
.getCurrentIndexCubit()
.resetTemporaryHandler(context.getDocumentBloc());
context.refresh();
context.bake();
}
Expand Down
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@
},
"packageManager": "[email protected]",
"devDependencies": {
"sass": "^1.82.0"
"sass": "^1.83.0"
}
}
93 changes: 46 additions & 47 deletions docs/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions metadata/en-US/changelogs/124.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
* Fix ruler not working correctly in pen tool
* Fix ruler position is wrong when moving on the canvas
* Fix zoom dependent not working correctly with the label tool ([#765](https://github.com/LinwoodDev/Butterfly/issues/765))
* Fix temporary import handler does not get removed after clicking
* Fix asset hash not correctly working with filenames
* Fix duplicated asset importing
* Upgrade to flutter 3.27

Read more here: https://linwood.dev/butterfly/2.2.3-rc.1

0 comments on commit 38878a7

Please sign in to comment.