mirror of https://gitlab.com/bashrc2/epicyon
Check for invalid directory
parent
aa8956827d
commit
8dc02ae340
10
announce.py
10
announce.py
|
@ -88,8 +88,9 @@ def undoAnnounceCollectionEntry(recentPostsCache: {}, \
|
|||
nickname=getNicknameFromActor(actor)
|
||||
cachedPostFilename= \
|
||||
getCachedPostFilename(baseDir,nickname,domain,postJsonObject)
|
||||
if os.path.isfile(cachedPostFilename):
|
||||
os.remove(cachedPostFilename)
|
||||
if cachedPostFilename:
|
||||
if os.path.isfile(cachedPostFilename):
|
||||
os.remove(cachedPostFilename)
|
||||
removePostFromCache(postJsonObject,recentPostsCache)
|
||||
|
||||
if not postJsonObject.get('type'):
|
||||
|
@ -144,8 +145,9 @@ def updateAnnounceCollection(recentPostsCache: {}, \
|
|||
nickname=getNicknameFromActor(actor)
|
||||
cachedPostFilename= \
|
||||
getCachedPostFilename(baseDir,nickname,domain,postJsonObject)
|
||||
if os.path.isfile(cachedPostFilename):
|
||||
os.remove(cachedPostFilename)
|
||||
if cachedPostFilename:
|
||||
if os.path.isfile(cachedPostFilename):
|
||||
os.remove(cachedPostFilename)
|
||||
removePostFromCache(postJsonObject,recentPostsCache)
|
||||
|
||||
if not postJsonObject.get('object'):
|
||||
|
|
10
bookmarks.py
10
bookmarks.py
|
@ -37,8 +37,9 @@ def undoBookmarksCollectionEntry(recentPostsCache: {}, \
|
|||
nickname=getNicknameFromActor(actor)
|
||||
cachedPostFilename= \
|
||||
getCachedPostFilename(baseDir,nickname,domain,postJsonObject)
|
||||
if os.path.isfile(cachedPostFilename):
|
||||
os.remove(cachedPostFilename)
|
||||
if cachedPostFilename:
|
||||
if os.path.isfile(cachedPostFilename):
|
||||
os.remove(cachedPostFilename)
|
||||
removePostFromCache(postJsonObject,recentPostsCache)
|
||||
|
||||
if not postJsonObject.get('type'):
|
||||
|
@ -143,8 +144,9 @@ def updateBookmarksCollection(recentPostsCache: {}, \
|
|||
nickname=getNicknameFromActor(actor)
|
||||
cachedPostFilename= \
|
||||
getCachedPostFilename(baseDir,nickname,domain,postJsonObject)
|
||||
if os.path.isfile(cachedPostFilename):
|
||||
os.remove(cachedPostFilename)
|
||||
if cachedPostFilename:
|
||||
if os.path.isfile(cachedPostFilename):
|
||||
os.remove(cachedPostFilename)
|
||||
removePostFromCache(postJsonObject,recentPostsCache)
|
||||
|
||||
if not postJsonObject.get('object'):
|
||||
|
|
10
like.py
10
like.py
|
@ -35,8 +35,9 @@ def undoLikesCollectionEntry(recentPostsCache: {}, \
|
|||
nickname=getNicknameFromActor(actor)
|
||||
cachedPostFilename= \
|
||||
getCachedPostFilename(baseDir,nickname,domain,postJsonObject)
|
||||
if os.path.isfile(cachedPostFilename):
|
||||
os.remove(cachedPostFilename)
|
||||
if cachedPostFilename:
|
||||
if os.path.isfile(cachedPostFilename):
|
||||
os.remove(cachedPostFilename)
|
||||
removePostFromCache(postJsonObject,recentPostsCache)
|
||||
|
||||
if not postJsonObject.get('type'):
|
||||
|
@ -117,8 +118,9 @@ def updateLikesCollection(recentPostsCache: {}, \
|
|||
nickname=getNicknameFromActor(actor)
|
||||
cachedPostFilename= \
|
||||
getCachedPostFilename(baseDir,nickname,domain,postJsonObject)
|
||||
if os.path.isfile(cachedPostFilename):
|
||||
os.remove(cachedPostFilename)
|
||||
if cachedPostFilename:
|
||||
if os.path.isfile(cachedPostFilename):
|
||||
os.remove(cachedPostFilename)
|
||||
removePostFromCache(postJsonObject,recentPostsCache)
|
||||
|
||||
if not postJsonObject.get('object'):
|
||||
|
|
9
utils.py
9
utils.py
|
@ -447,8 +447,15 @@ def getCachedPostFilename(baseDir: str,nickname: str,domain: str, \
|
|||
postJsonObject: {}) -> str:
|
||||
"""Returns the html cache filename for the given post
|
||||
"""
|
||||
cachedPostDir=getCachedPostDirectory(baseDir,nickname,domain)
|
||||
if not os.path.isdir(cachedPostDir):
|
||||
print('ERROR: invalid html cache directory '+cachedPostDir)
|
||||
return None
|
||||
if '@' not in cachedPostDir:
|
||||
print('ERROR: invalid html cache directory '+cachedPostDir)
|
||||
return None
|
||||
cachedPostFilename= \
|
||||
getCachedPostDirectory(baseDir,nickname,domain)+ \
|
||||
cachedPostDir+ \
|
||||
'/'+postJsonObject['id'].replace('/activity','')
|
||||
print('CACHE: 1 '+nickname+' '+domain+' '+cachedPostFilename)
|
||||
if '#' in cachedPostFilename:
|
||||
|
|
|
@ -1948,6 +1948,9 @@ def loadIndividualPostAsHtmlFromCache(baseDir: str,nickname: str,domain: str, \
|
|||
cachedPostFilename=getCachedPostFilename(baseDir,nickname,domain,postJsonObject)
|
||||
|
||||
postHtml=''
|
||||
if not cachedPostFilename:
|
||||
return postHtml
|
||||
|
||||
if not os.path.isfile(cachedPostFilename):
|
||||
return postHtml
|
||||
|
||||
|
|
Loading…
Reference in New Issue