From 67cb81497b0ffff2646954f698bebce57c941f80 Mon Sep 17 00:00:00 2001 From: Offray Luna Date: Wed, 9 Mar 2022 17:53:57 -0500 Subject: [PATCH] Using large uids to avoid metadata colision. --- repository/TiddlyWiki/Tiddler.class.st | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/repository/TiddlyWiki/Tiddler.class.st b/repository/TiddlyWiki/Tiddler.class.st index 2d29439..6a04ca7 100644 --- a/repository/TiddlyWiki/Tiddler.class.st +++ b/repository/TiddlyWiki/Tiddler.class.st @@ -136,6 +136,11 @@ Tiddler >> customFields [ ^ customFields ifNil: [ customFields := Dictionary new] ] +{ #category : #accessing } +Tiddler >> deleteUid [ + self customFields deleteKey: 'uid'. +] + { #category : #accessing } Tiddler >> exportJSONFile [ | jsonFile | @@ -155,7 +160,7 @@ Tiddler >> exportSTONFileInto: subfolder [ | stonFile output dashedTitle sanitized | dashedTitle := '-' join: (self title substrings collect: [ :each | each ]). sanitized := dashedTitle copyWithoutAll: #($¿ $? $! $¡ $/). - stonFile := self wiki file parent / subfolder / (sanitized, '--', self uid, '.ston'). + stonFile := self wiki file parent / subfolder / (sanitized, '--', (self uid copyFrom: 1 to: 5), '.ston'). ^ MarkupFile exportAsFileOn: stonFile containing: self asStonStringPretty ] @@ -458,13 +463,19 @@ Tiddler >> type: anObject [ { #category : #accessing } Tiddler >> uid [ + ^ self customFields at: 'uid' ifAbsentPut: [ self uidGenerator ]. + +] + +{ #category : #accessing } +Tiddler >> uidGenerator [ + | tempId | self created - ifNotNil: [ tempId := self created hash hex copyFrom: 1 to: 5. ] - ifNil: [ tempId := self class nowLocal hash hex copyFrom: 1 to: 5 ]. + ifNotNil: [ tempId := self created hash hex. ] + ifNil: [ tempId := self class nowLocal hash hex ]. self customFields at: 'uid' put: tempId . ^ tempId - ] { #category : #accessing }