mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-23 06:37:15 +00:00
fix: [Duplicate] show duplicate with relative path
This commit is contained in:
parent
5afbc3179c
commit
ea7fd8d54c
3 changed files with 10 additions and 1 deletions
|
@ -84,7 +84,10 @@ class Paste(object):
|
||||||
|
|
||||||
PASTES_FOLDER = os.path.join(os.environ['AIL_HOME'], cfg.get("Directories", "pastes"))
|
PASTES_FOLDER = os.path.join(os.environ['AIL_HOME'], cfg.get("Directories", "pastes"))
|
||||||
if PASTES_FOLDER not in p_path:
|
if PASTES_FOLDER not in p_path:
|
||||||
|
self.p_rel_path = p_path
|
||||||
p_path = os.path.join(PASTES_FOLDER, p_path)
|
p_path = os.path.join(PASTES_FOLDER, p_path)
|
||||||
|
else:
|
||||||
|
self.p_rel_path = None
|
||||||
|
|
||||||
self.p_path = p_path
|
self.p_path = p_path
|
||||||
self.p_name = os.path.basename(self.p_path)
|
self.p_name = os.path.basename(self.p_path)
|
||||||
|
@ -284,6 +287,8 @@ class Paste(object):
|
||||||
|
|
||||||
def _get_p_duplicate(self):
|
def _get_p_duplicate(self):
|
||||||
self.p_duplicate = self.store_metadata.smembers('dup:'+self.p_path)
|
self.p_duplicate = self.store_metadata.smembers('dup:'+self.p_path)
|
||||||
|
if self.p_rel_path is not None:
|
||||||
|
self.p_duplicate.union( self.store_metadata.smembers('dup:'+self.p_rel_path) )
|
||||||
if self.p_duplicate is not None:
|
if self.p_duplicate is not None:
|
||||||
return list(self.p_duplicate)
|
return list(self.p_duplicate)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -28,6 +28,7 @@ r_serv_statistics = Flask_config.r_serv_statistics
|
||||||
max_preview_char = Flask_config.max_preview_char
|
max_preview_char = Flask_config.max_preview_char
|
||||||
max_preview_modal = Flask_config.max_preview_modal
|
max_preview_modal = Flask_config.max_preview_modal
|
||||||
bootstrap_label = Flask_config.bootstrap_label
|
bootstrap_label = Flask_config.bootstrap_label
|
||||||
|
PASTES_FOLDER = Flask_config.PASTES_FOLDER
|
||||||
|
|
||||||
Tags = Blueprint('Tags', __name__, template_folder='templates')
|
Tags = Blueprint('Tags', __name__, template_folder='templates')
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,9 @@ showsavedpastes = Blueprint('showsavedpastes', __name__, template_folder='templa
|
||||||
# ============ FUNCTIONS ============
|
# ============ FUNCTIONS ============
|
||||||
|
|
||||||
def showpaste(content_range, requested_path):
|
def showpaste(content_range, requested_path):
|
||||||
|
relative_path = None
|
||||||
if PASTES_FOLDER not in requested_path:
|
if PASTES_FOLDER not in requested_path:
|
||||||
|
relative_path = requested_path
|
||||||
requested_path = os.path.join(PASTES_FOLDER, requested_path)
|
requested_path = os.path.join(PASTES_FOLDER, requested_path)
|
||||||
# remove old full path
|
# remove old full path
|
||||||
#requested_path = requested_path.replace(PASTES_FOLDER, '')
|
#requested_path = requested_path.replace(PASTES_FOLDER, '')
|
||||||
|
@ -122,6 +124,8 @@ def showpaste(content_range, requested_path):
|
||||||
active_taxonomies = r_serv_tags.smembers('active_taxonomies')
|
active_taxonomies = r_serv_tags.smembers('active_taxonomies')
|
||||||
|
|
||||||
l_tags = r_serv_metadata.smembers('tag:'+requested_path)
|
l_tags = r_serv_metadata.smembers('tag:'+requested_path)
|
||||||
|
if relative_path is not None:
|
||||||
|
l_tags.union( r_serv_metadata.smembers('tag:'+relative_path) )
|
||||||
|
|
||||||
#active galaxies
|
#active galaxies
|
||||||
active_galaxies = r_serv_tags.smembers('active_galaxies')
|
active_galaxies = r_serv_tags.smembers('active_galaxies')
|
||||||
|
@ -224,7 +228,6 @@ def showpaste(content_range, requested_path):
|
||||||
@showsavedpastes.route("/showsavedpaste/") #completely shows the paste in a new tab
|
@showsavedpastes.route("/showsavedpaste/") #completely shows the paste in a new tab
|
||||||
def showsavedpaste():
|
def showsavedpaste():
|
||||||
requested_path = request.args.get('paste', '')
|
requested_path = request.args.get('paste', '')
|
||||||
print(requested_path)
|
|
||||||
return showpaste(0, requested_path)
|
return showpaste(0, requested_path)
|
||||||
|
|
||||||
@showsavedpastes.route("/showsavedrawpaste/") #shows raw
|
@showsavedpastes.route("/showsavedrawpaste/") #shows raw
|
||||||
|
|
Loading…
Reference in a new issue