From 94058e24cbf52a4568605d9841bc1de58585dec1 Mon Sep 17 00:00:00 2001 From: Offray Luna Date: Mon, 8 Apr 2019 22:19:12 +0000 Subject: [PATCH] Supporting unversioned files. --- repository/Fossil/FossilRepo.class.st | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/repository/Fossil/FossilRepo.class.st b/repository/Fossil/FossilRepo.class.st index f95ed3d..d66867b 100644 --- a/repository/Fossil/FossilRepo.class.st +++ b/repository/Fossil/FossilRepo.class.st @@ -57,6 +57,14 @@ FossilRepo >> fetchPage: pageName [ ^ NeoJSONReader fromString: (self jsonWikiDataFor: 'get/', pageName) ] +{ #category : #utilities } +FossilRepo >> isUnversioned: aFileNameWithRelativePath [ + + ^ (aFileNameWithRelativePath beginsWith: 'uv') + ifTrue: [ ^ aFileNameWithRelativePath ] + ifFalse: [ ^ '/doc/tip/', aFileNameWithRelativePath ] +] + { #category : #utilities } FossilRepo >> jsonDataFor: anUrlSegment [ @@ -91,7 +99,7 @@ FossilRepo >> lastVersionPath: aFileNameWithRelativePath [ and return a relative route to the last version of the file in the first case or the unversioned one." - (aFileNameWithRelativePath beginsWith: '/uv') + (self isUnversioned: aFileNameWithRelativePath) ifTrue: [ ^ aFileNameWithRelativePath ] ifFalse: [ ^ '/doc/tip/', aFileNameWithRelativePath ] ] @@ -149,9 +157,9 @@ FossilRepo >> sanitize: aFileNameWithRelativePath [ "I dicern if my argument concerns to a versioned or an unversioned file, and return a relative path to put the file." - (aFileNameWithRelativePath beginsWith: '/uv') + (self isUnversioned: aFileNameWithRelativePath) ifFalse: [ ^ aFileNameWithRelativePath ] - ifTrue: [ ^ (aFileNameWithRelativePath copyFrom: 5 to: aFileNameWithRelativePath size) ] + ifTrue: [ ^ (aFileNameWithRelativePath copyFrom: 4 to: aFileNameWithRelativePath size) ] ] { #category : #authentication }