Supporting unversioned files.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2019-04-08 22:19:12 +00:00
parent 90f1e8279c
commit 94058e24cb
1 changed files with 11 additions and 3 deletions

View File

@ -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 }