Merged changes from master.

This commit is contained in:
luccioman 2016-07-20 00:37:31 +02:00
commit 47d486298f
10 changed files with 331 additions and 74 deletions

View File

@ -104,6 +104,11 @@ Augmented Browsing:==Angereichertes Browsing:
Enables or disables augmented browsing. If enabled, all websites will be modified during loading.==Schaltet angereichertes Browsing an oder ab. Wenn aktiviert werden alle Webseite während des Ladens modifiziert.
#-----------------------------
#File: Autocrawl_p.html
#---------------------------
"Save"=="Speichern"
#-----------------------------
#File: Blacklist_p.html
#---------------------------
Blacklist Administration==Blacklist Verwaltung

View File

@ -9,7 +9,7 @@
# This file is maintained by gDupont
# This file is written by gDupont, Marsupoil, Mikayé, Moubai
# If you find any mistakes or untranslated strings in this file please don't hesitate to email them to the maintainer.
# If you find any mistakes or untranslated strings in this file please don't hesitate to email them to the maintainer.
#File: ConfigLanguage_p.html
#---------------------------
@ -21,53 +21,157 @@
<!-- maintainer -->==gDupont
#-----------------------------
#File: AccessGrid_p.html
#---------------------------
YaCy Network Access==Accès réseau
Server Access Grid==Grille d'accès au serveur
This images shows incoming connections to your YaCy peer and outgoing connections from your peer to other peers and web servers==Cette image montre les connexions entrant vers votre instance YaCy et les connexions sortant de votre instance vers les autres pairs et serveurs web
#-----------------------------
#File: Blacklist_p.html
#---------------------------
Blacklist Manager==Gestionnaire des listes noire
Used Blacklist engine:==Moteur de liste noire utilis&eacute;:
This function provides an URL filter to the proxy; any blacklisted URL is blocked from being loaded.==Cette fonction fournit un filtre d'URL sur le serveur Proxy;. Toute URL provenant de la liste noire ne pourra &ecirc;tre charg&eacute;.
You can define several blacklists and activate them separately.==Vous pouvez d&eacute;finir de nombreuses listes noires et les activer s&eacute;par&eacute;ment.
You may also provide your blacklist to other peers by sharing them; in return you may==Vous pouvez aussi partager vos listes noires avec d'autres noeuds du r&eacute;seau; en retour vous pourrez
collect blacklist entries from other peers.==collecter celles des autres.
This function provides an URL filter to the proxy; any blacklisted URL is blocked==Cette fonction permet d'ajouter un filtrage d'URL au proxy; toute URL présente dans la liste noire est bloquée.
Blacklist Administration==Administration de liste noire
from being loaded. You can define several blacklists and activate them separately.==Vous pouvez définir plusieurs listes noires et les activer séparément.
Select list to edit:==Sélectionnez la liste à éditer :
Create new list:==Créer une nouvelle liste :
Edit list==Modifier la liste
These are the domain name/path patterns in==Motifs de noms de domaine/adresses dans
Blacklist Pattern==Entrées
Edit selected pattern(s)==Editer l(es) entrée(s) sélectionnée(s)
Delete selected pattern(s)==Supprimer l(es) entrée(s) sélectionnée(s)
Move selected pattern(s) to==Déplacer l(es) entrée(s) sélectionnée(s) vers
Add new pattern:==Ajouter une nouvelle entrée :
The right '*', after the '/', can be replaced by a==Le caractère '*' à droite, après le '/', peut être remplacé par une
>regular expression<==>expression régulière<
a complete <==une <
(slow)==(lent)
Show entries:==Afficher les entrées :
Entries per page:==Entrées par page :
"set"=="Appliquer"
Edit existing pattern(s):==Modifier l(es) entrée(s) existante(s)
"Save URL pattern(s)"=="Enregistrer"
Settings for this list==Param&egrave;tres de la liste
"create"=="Cr&eacute;er"
Add URL pattern==Ajouter
You may also provide your blacklist to other peers by sharing them; in return you may==Vous pouvez aussi partager vos listes noires avec les autres noeuds du r&eacute;seau; en retour vous pourrez
collect blacklist entries from other peers.==importer celles des autres.
Share/don't share this list==Partager/Ne pas partager
Delete this list==Supprimer
"Save"=="Appliquer"
Active list:==Liste active:
No blacklist selected==Aucune liste noire s&eacute;lectionn&eacute;e
Select list:==S&eacute;lectionner une liste:
not shared::shared==non partag&eacute;::partag&eacute;
"select"=="s&eacute;lectionner"
New list:==Nouvelle liste:
"create"=="cr&eacute;er"
Settings for this list==Param&egrave;tres de cette liste
"Save"=="Sauvegarder"
Share/don't share this list==Partager/ne pas partager cette liste
Delete this list==Supprimer cette liste
Edit this list==&eacute;diter cette liste
These are the domain name / path patterns in this blacklist:==Les noms de domaines/ mod&egrave;le de chemin dans la liste noire:
You can select them here for deletion==Vous pouvez les s&eacute;lectionner pour la suppression
Delete URL pattern==Supprimer le mod&egrave;le d'URL
Add URL pattern==Ajouter un mod&egrave;le d'URL
Import blacklist items from...==Importer les donn&eacute;es d'une liste noire depuis...
other YaCy peers:==Autre noeud Yacy:
file:==fichiers:
"Load new blacklist items"=="Charger les nouvelles donn&eacute;es de la liste noire"
#URL:==URL:
was removed from blacklist==a(ont) &eacute;t&eacute; supprim&eacute;(s) de la liste noire
was added to the blacklist==a(ont) &eacute;t&eacute; ajout&eacute;(s) &agrave; la liste noire
Activate this list for==Activer cette liste pour
#-----------------------------
#File: AccessTracker_p.html
#---------------------------
Access Tracker==Suivi des connexions
Server Access Overview==Vue d'ensemble des accès serveur
This is a list of #[num]# requests to the local http server within the last hour.==Liste des #[num]# requêtes vers le serveur http local pendant l'heure précédente.
Showing #[num]# requests.==Affichage de #[num]# requêtes.
>Host<==>Hôte<
>Path<==>Chemin<
Access Count During==Nombre d'accès par période prédécente
last Second==Seconde
last Minute==Minute
last 10 Minutes==10 Minutes
last Hour==Heure
The following hosts are registered as source for brute-force requests to protected pages==Les hôtes suivants sont enregistrés comme sources pour des requêtes de force brute vers des pages protégées
Access Times==Temps d'Accès
Server Access Details==Détails des Accès Serveur
Local Search Log==Recherche dans le journal local
Local Search Host Tracker==Suivi des recherches locales
Remote Search Log==Journal des recherches distantes
Success:==Succès:
Remote Search Host Tracker==Suivi des recherches distantes
This is a list of searches that had been requested from this' peer search interface==Liste des requêtes lancées depuis l'interface de recherche de cette instance
Showing #[num]# entries from a total of #[total]# requests.==Affichage de #[num]# entrées sur un total de #[tota]# requêtes.
Requesting Host==Hôte appelant
Expected Results==Résultats attendus
Returned Results==Résultats renvoyés
Used Time (ms)==Temps utilisé (ms)
URL fetch (ms)==Récupération d'URL (ms)
Snippet comp (ms)==Traitement de 'Snippet' (ms)
Query==Requête
Search Word Hashes==Hash des mots recherchés
Count</td>==Décompte</td>
Queries Per Last Hour==Requêtes sur l'heure précédente
Access Dates==Dates d'accès
This is a list of searches that had been requested from remote peer search interface==Liste des recherches effectuées depuis l'interface de recherche de pairs distants
This is a list of requests (max. 1000) to the local http server within the last hour.==Liste des requêtes (max. 1000) vers le serveur http local pendant l'heure précédente.
#-----------------------------
#File: BlacklistImpExp_p.html
#---------------------------
Blacklist Import==Import de liste noire
Used Blacklist engine:==Gestionnaire de liste noire utilisé :
Import blacklist items from...==Imorter des entrées de liste noire depuis...
other YaCy peers:==D'autres pairs YaCy :
"Load new blacklist items"=="Importer"
plain text file:<==Un fichier texte brut :<
XML file:==Un fichier XML :
Upload a regular text file which contains one blacklist entry per line.==Importer un fichier texte brut contenant une entrée de liste noire par ligne.
Upload an XML file which contains one or more blacklists.==Importer un fichier XML contenant une ou plusieurs listes noires.
Export blacklist items to...==Exporter les éléments de liste noire vers...
Here you can export a blacklist as an XML file. This file will contain additional==Vous pouvez exporter ici une liste noire vers un fichier XML. Ce fichier contient des informations supplémentaires
information about which cases a blacklist is activated for.==décrivant les cas pour lesquels cette liste noire est activée.
"Export list as XML"=="Export XML"
Here you can export a blacklist as a regular text file with one blacklist entry per line.==Vous pouvez exporter ici une liste noire vers un fichier texte brut contenant une entrée de liste noire par ligne.
This file will not contain any additional information==Ce fichier ne contiendra aucune information supplémentaire
"Export list as text"=="Export texte"
URL:==Une URL :
#-----------------------------
#File: AugmentedBrowsing_p.html
#---------------------------
Augmented Browsing<==Navigation augmentée<
URL Proxy Settings<==Configuration du Proxy<
With this settings you can activate or deactivate URL proxy which is the method used for augmentation.==Avec cette configuration, vous pouvez activer ou désactiver le proxy utilisé pour la navigation augmentée.
Service call: ==Appel du service :
, where parameter is the url of an external web page.==, où parameter est l'url d'une page web externe.
>URL proxy:<==>Proxy:<
>Enabled<==>Activé<
Globally enables or disables URL proxy via ==Active ou désactive globalement le proxy via
Show search results via URL proxy:==Afficher les résultats de recherche via le proxy :
Enables or disables URL proxy for all search results. If enabled, all search results will be tunneled through URL proxy.==Active ou désactive le proxy pour tous les résultats de recherche. Lorsqu'activé, tous les résultats de recherche seront encapsulés par le proxy.
Alternatively you may add this javascript to your browser favorites/short-cuts, which will reload the current browser address==Alternativement vous pouvez ajouter ce JavaScript aux favoris/marques-pages de votre navigateur, qui rechargera l'adresse courante
via the YaCy proxy servlet.==via la servlet proxy de YaCy.
or right-click this link and add to favorites:==ou bien faites un clic droit sur ce lien et créez un marque-page :
Restrict URL proxy use:==Restriction d'utilisation du proxy
Define client filter. Default: ==Définit un filtre client. Par défaut :
URL substitution:==Substitution d'URL :
Define URL substitution rules which allow navigating in proxy environment. Possible values: all, domainlist. Default: domainlist.==Définit les règles de substitution d'URL qui permettent de naviguer avec le proxy. Valeurs possibles : all, domainlist. Par défaut: domainlist.
"Submit"=="Enregistrer"
#-----------------------------
#File: Blog.html
#---------------------------
Comments</a>==Commentaires</a>
Edit<==Modifier<
previous entries==Entrées précédentes
next entries==Entrées suivantes
new entry==Nouvelle entr&eacute;e
import XML-File==Importer des donn&eacute;es XML
export as XML==Exporter en XML
Comments:==Commentaires :
deactivated==désactivés
>activated==>activés
moderated==modérés
Are you sure==Etes-vous sûr
that you want to delete==de vouloir supprimer
Confirm deletion==Confirmation
Yes, delete it.==Oui, supprimer.
No, leave it.==Non, conserver.
by==par
>edit==>&eacute;diter
>delete==>supprimer
show more entries==montrer plus d'entr&eacute;es
new entry==nouvelle entr&eacute;e
import XML-File==importer des donn&eacute;es XML
export as XML==exporter en XML
Blog-Home==Accueil du blog
Author:==Auteur:
Subject:==Titre:
Text:==Texte:
>edit==>&eacute;diter
You can use==Vous pouvez utiliser
Yacy-Wiki Code==le code YaCy-Wiki
here.==ici.
@ -78,15 +182,43 @@ here.==ici.
No changes have been submitted so far!==Aucun changement n'a &eacute;t&eacute; soumis !
Access denied==Acc&egrave;s refus&eacute;
To edit or create blog-entries you need to be logged in as Admin or User who has Blog rights.==Pour &eacute;diter ou cr&eacute;er des entr&eacute;es dans ce blog, vous devez &ecirc;tre enregistr&eacute; en tant qu'administrateur ou en tant qu'utilisateur avec des droits d'acc&egrave;s au blog.
Are you sure==&ecirc;tes vous sûr
that you want to delete <strong>#[subject]#</strong> by #[author]#?==ce que vous souhaitez supprimer <strong>#[subject]#</strong> de #[author]# ?
Yes, delete it.==Oui, le supprimer.
No, leave it.==Non, le laisser.
Import was successful!==L'importation a r&eacute;ussi !
Import failed, maybe the supplied file was no valid blog-backup?==L'importation a &eacute;chou&eacute;, peut-&ecirc;tre que le fichier import&eacute; n'&eacute;tait pas une archive de blog valide?
Please select the XML-file you want to import:==S&eacute;lectionnez le fichier XML que vous souhaitez importer :
#-----------------------------
#File: BlacklistCleaner_p.html
#---------------------------
Blacklist Cleaner==Nettoyage de Liste Noire
Here you can remove or edit illegal or double blacklist-entries.==Vous pouvez nettoyer ici les entrées de liste noire incorrectes ou en double.
"Check"=="Vérifier"
Allow regular expressions in host part of blacklist entries.==Autoriser les expressions régulières dans la partie hôte des entrées de liste noire.
The blacklist-cleaner only works for the following blacklist-engines up to now:==Le nettoyeur de blacklist fonctionne seulement pour les gestionnaires de liste noire suivants jusqu'à maintenant :
Illegal Entries in #[blList]# for==Entrées incorrectes dans #[blList]# pour
Deleted #[delCount]# entries==#[delCount]# entrées supprimées
Altered #[alterCount]# entries!==#[alterCount]# entrées modifiées!
Two wildcards in host-part==Deux caractères génériques dans la partie hôte
Either subdomain <u>or</u> wildcard==Soit un sous-domaine <u>soit</u> un caractère générique
Path is invalid Regex==Le chemin est une expression régulière non valide
Wildcard not on begin or end==Pas de caractère générique au début ou à la fin
Host contains illegal chars==L'hôte contient des caractères incorrects
Double==Doublon
"Change Selected"=="Modifier Sélectionné"
"Delete Selected"=="Supprimer Sélectionné"
No Blacklist selected==Pas de blacklist sélectionnée
#-----------------------------
#File: BlacklistTest_p.html
#---------------------------
Blacklist Test==Test de liste noire
Used Blacklist engine:==Gestionnaire de liste noire :
Test list:==Test de liste :
The tested URL was==URL testée :
It is blocked for the following cases:==Blocage dans les cas suivants :
Search==Recherche
Surftips==Recommendations
#-----------------------------
#File: Bookmarks.html
#---------------------------
YaCy '#[clientname]#': Bookmarks==YaCy '#[clientname]#': Marque-pages
@ -155,15 +287,6 @@ Time used==Temps utilis&eacute;
Save User==Sauvegarder l'utilisateur
#-----------------------------
#File: ConfigAdvanced_p.html
#---------------------------
Advanced Config==Configuration avanc&eacute;e
Here are all configuration options from YaCy.==Toutes les options de configuration de YaCy sont ici.
You can change anything, but some options need a restart, and some options can crash YaCy, if wrong values are used.==Vous pouvez tout changer, mais certaines options n&eacute;cessitent un red&eacute;marrage et certaines autres peuvent provoquer l'arr&ecirc;t de YaCy si elles sont mal choisies.
For explanation please look into defaults/yacy.init==Pour des explications, regardez dans le fichier « defaults/yacy.init ».
"Save"=="Sauvegarder"
#-----------------------------
#File: ConfigBasic.html
#---------------------------
Access Configuration==Configuration de l'acc&egrave;s
@ -270,6 +393,15 @@ You can use==Vous pouvez utiliser
here.==ici.
#-----------------------------
#File: ConfigProperties_p.html
#---------------------------
Advanced Config==Configuration avanc&eacute;e
Here are all configuration options from YaCy.==Toutes les options de configuration de YaCy sont ici.
You can change anything, but some options need a restart, and some options can crash YaCy, if wrong values are used.==Vous pouvez tout changer, mais certaines options n&eacute;cessitent un red&eacute;marrage et certaines autres peuvent provoquer l'arr&ecirc;t de YaCy si elles sont mal choisies.
For explanation please look into defaults/yacy.init==Pour des explications, regardez dans le fichier « defaults/yacy.init ».
"Save"=="Sauvegarder"
#-----------------------------
#File: ConfigSkins_p.html
#---------------------------
Skin Selection==Choix de th&egrave;me
@ -2300,8 +2432,8 @@ Timing Settings for Search Sequence==Param&egrave;tres temporels la recherche
Ranking and Heuristics==Classement et heuristique
#Solr Ranking Config==Solr Ranking Config
#RWI Ranking Config==RWI Ranking Config
>Heuristics<==>==Heuristiques<
#---------------------------
>Heuristics<==>Heuristiques<
#-----------------------------
#File: env/templates/submenuUseCaseAccount.template
#---------------------------

View File

@ -190,6 +190,62 @@
</body>
</file>
<file original="Autocrawl_p.html" source-language="en" datatype="html">
<body>
<trans-unit id="263005b5" xml:space="preserve" approved="no" translate="yes">
<source>&gt;Autocrawler&lt;</source>
</trans-unit>
<trans-unit id="7015ea9" xml:space="preserve" approved="no" translate="yes">
<source>Autocrawler automatically selects and adds tasks to the local crawl queue.</source>
</trans-unit>
<trans-unit id="173d9787" xml:space="preserve" approved="no" translate="yes">
<source>This will work best when there are already quite a few domains in the index.</source>
</trans-unit>
<trans-unit id="ef85f111" xml:space="preserve" approved="no" translate="yes">
<source>Autocralwer Configuration</source>
</trans-unit>
<trans-unit id="45fd99f0" xml:space="preserve" approved="no" translate="yes">
<source>You need to restart for some settings to be applied</source>
</trans-unit>
<trans-unit id="7b631d2" xml:space="preserve" approved="no" translate="yes">
<source>Enable Autocrawler:</source>
</trans-unit>
<trans-unit id="66a1bd2c" xml:space="preserve" approved="no" translate="yes">
<source>Deep crawl every:</source>
</trans-unit>
<trans-unit id="2291c65d" xml:space="preserve" approved="no" translate="yes">
<source>Warning: if this is bigger than "Rows to fetch" only shallow crawls will run.</source>
</trans-unit>
<trans-unit id="46c18c30" xml:space="preserve" approved="no" translate="yes">
<source>Rows to fetch at once:</source>
</trans-unit>
<trans-unit id="6b6b7b1b" xml:space="preserve" approved="no" translate="yes">
<source>Recrawl only older than # days:</source>
</trans-unit>
<trans-unit id="1472a55c" xml:space="preserve" approved="no" translate="yes">
<source>Get hosts by query:</source>
</trans-unit>
<trans-unit id="6dd8103f" xml:space="preserve" approved="no" translate="yes">
<source>Can be any valid Solr query.</source>
</trans-unit>
<trans-unit id="bc75d794" xml:space="preserve" approved="no" translate="yes">
<source>Shallow crawl depth (0 to 2):</source>
</trans-unit>
<trans-unit id="6c1bc4ce" xml:space="preserve" approved="no" translate="yes">
<source>Deep crawl depth (1 to 5):</source>
</trans-unit>
<trans-unit id="5c70dfbf" xml:space="preserve" approved="no" translate="yes">
<source>Index text:</source>
</trans-unit>
<trans-unit id="25aff004" xml:space="preserve" approved="no" translate="yes">
<source>Index media:</source>
</trans-unit>
<trans-unit id="3ec44343" xml:space="preserve" approved="no" translate="yes">
<source>"Save"</source>
</trans-unit>
</body>
</file>
<file original="BlacklistCleaner_p.html" source-language="en" datatype="html">
<body>
<trans-unit id="da2f8473" xml:space="preserve" approved="no" translate="yes">
@ -560,6 +616,9 @@
<trans-unit id="824e78ee" xml:space="preserve" approved="no" translate="yes">
<source>Please select the XML-file you want to import:</source>
</trans-unit>
<trans-unit id="4cf708d" xml:space="preserve" approved="no" translate="yes">
<source>Text:</source>
</trans-unit>
</body>
</file>

View File

@ -137,15 +137,6 @@ Show==Zobraz
Bookmarks per page.==z&aacute;loziek na str&aacute;nku.
#-----------------------------
#File: ConfigAdvanced_p.html
#---------------------------
Advanced Config==Pokrocile nastavenia
Here are all configuration options from YaCy.==Tu sa nachadzaju vsetky konfiguracne nastavenia YaCy.
You can change anything, but some options need a restart, and some options can crash YaCy, if wrong values are used.==Vsetky konfiguracne nastavenia mozu byt zmenene, avsak niektore volby vyzaduju restart a niektore mozu sposobit pad YaCy v pripade zadnia nespravnych hodnot.
For explanation please look into defaults/yacy.init==Vysvetlenie najdete v subore defaults/yacy.init
"Save"=="Uloz"
#-----------------------------
#File: ConfigBasic.html
#---------------------------
Select a language for the interface==Zvolte jazyk web rozhrania
@ -223,6 +214,15 @@ Comment==Koment&aacute;r
"Save"=="Uloz profil"
#-----------------------------
#File: ConfigProperties_p.html
#---------------------------
Advanced Config==Pokrocile nastavenia
Here are all configuration options from YaCy.==Tu sa nachadzaju vsetky konfiguracne nastavenia YaCy.
You can change anything, but some options need a restart, and some options can crash YaCy, if wrong values are used.==Vsetky konfiguracne nastavenia mozu byt zmenene, avsak niektore volby vyzaduju restart a niektore mozu sposobit pad YaCy v pripade zadnia nespravnych hodnot.
For explanation please look into defaults/yacy.init==Vysvetlenie najdete v subore defaults/yacy.init
"Save"=="Uloz"
#-----------------------------
#File: ConfigSkins_p.html
#---------------------------
Skin Selection==Vyber skinov
@ -1852,7 +1852,6 @@ user</a> page.==stranky pouzivatelov</a>.
#File: ViewFile.html
#---------------------------
YaCy '#[clientname]#': View URL Content==YaCy '#[clientname]#': Zobraz obsah URL adresy
View URL Content==Zobraz obsah URL adresy
#URL==URL
#Hash==Hash

View File

@ -137,14 +137,18 @@ public class GenericFormatter extends AbstractFormatter implements DateFormatter
* @throws ParseException
*/
public Calendar parse(final String timeString, final String UTCOffset) throws ParseException {
// FIXME: This method returns an incorrect date, check callers!
// ex: de.anomic.server.serverDate.parseShortSecond("20070101120000", "+0200").toGMTString()
// => 1 Jan 2007 13:00:00 GMT
if (timeString == null || timeString.isEmpty()) { return Calendar.getInstance(UTCtimeZone); }
if (UTCOffset == null || UTCOffset.isEmpty()) { return Calendar.getInstance(UTCtimeZone); }
return parse(timeString, UTCDiff(UTCOffset));
return parse(timeString, UTCDiff(UTCOffset)); // offset expected in min
}
/**
* Calculates the time offset in minutes given as timezoneoffsetstring (diffString)
* e.g. "+0300" returns 180
*
* @param diffString with fixed timezone format
* @return parsed timezone string in minutes
*/
private static int UTCDiff(final String diffString) {
if (diffString.length() != 5) throw new IllegalArgumentException("UTC String malformed (wrong size):" + diffString);
boolean ahead = true;
@ -153,7 +157,7 @@ public class GenericFormatter extends AbstractFormatter implements DateFormatter
else throw new IllegalArgumentException("UTC String malformed (wrong sign):" + diffString);
final int oh = NumberTools.parseIntDecSubstring(diffString, 1, 3);
final int om = NumberTools.parseIntDecSubstring(diffString, 3);
return (int) ((ahead) ? 1 : -1 * (oh * AbstractFormatter.hourMillis + om * AbstractFormatter.minuteMillis));
return (int) ( ((ahead) ? 1 : -1) * (oh * 60 + om));
}
/**

View File

@ -244,11 +244,12 @@ public class DigestURL extends MultiProtocolURL implements Serializable {
// find rootpath
int rootpathStart = 0;
int rootpathEnd = this.path.length() - 1;
if (!this.path.isEmpty() && this.path.charAt(0) == '/')
if (!this.path.isEmpty() && (this.path.charAt(0) == '/' || this.path.charAt(0) == '\\'))
rootpathStart = 1;
if (this.path.endsWith("/"))
rootpathEnd = this.path.length() - 2;
p = this.path.indexOf('/', rootpathStart);
if (this.isFile() && p < 0) p = this.path.indexOf('\\', rootpathStart); // double-check for windows path (if it's a file url)
String rootpath = "";
if (p > 0 && p < rootpathEnd) {
rootpath = this.path.substring(rootpathStart, p);
@ -264,7 +265,7 @@ public class DigestURL extends MultiProtocolURL implements Serializable {
final StringBuilder hashs = new StringBuilder(12);
assert hashs.length() == 0;
// form the 'local' part of the hash
final String normalform = toNormalform(true, true);
final String normalform = toNormalform(true, true); // normalizes also Windows backslash in path to '/' for file url
final String b64l = Base64Order.enhancedCoder.encode(Digest.encodeMD5Raw(normalform));
if (b64l.length() < 5) return null;
hashs.append(b64l.substring(0, 5)); // 5 chars

View File

@ -216,7 +216,13 @@ public class MultiProtocolURL implements Serializable, Comparable<MultiProtocolU
if (!this.protocol.equals("file") && url.substring(p + 1, p + 3).equals("//")) {
// identify host, userInfo and file for http and ftp protocol
int q = url.indexOf('/', p + 3);
if (q < 0) q = url.indexOf("?", p + 3); // check for www.test.com?searchpart
if (q < 0) { // check for www.test.com?searchpart
q = url.indexOf("?", p + 3);
} else { // check that '/' was not in searchpart (example http://test.com?data=1/2/3)
if (url.lastIndexOf("?", q) >= 0) {
q = url.indexOf("?", p + 3);
}
}
int r;
if (q < 0) {
if ((r = url.indexOf('@', p + 3)) < 0) {
@ -832,7 +838,7 @@ public class MultiProtocolURL implements Serializable, Comparable<MultiProtocolU
}
/**
* Get extension out of a filename
* Get extension out of a filename in lowercase
* cuts off query part
* @param fileName
* @return extension or ""
@ -1064,8 +1070,14 @@ public class MultiProtocolURL implements Serializable, Comparable<MultiProtocolU
return toNormalform(excludeAnchor, false);
}
/**
* Generates a normal form of the URL.
* For file: url it normalizes also path delimiter to be '/' (replace possible Windows '\'
* @param excludeAnchor
* @param removeSessionID
* @return
*/
public String toNormalform(final boolean excludeAnchor, final boolean removeSessionID) {
// generates a normal form of the URL
boolean defaultPort = false;
if (this.protocol.equals("mailto")) {
return this.protocol + ":" + this.userInfo + "@" + this.host;
@ -1096,6 +1108,9 @@ public class MultiProtocolURL implements Serializable, Comparable<MultiProtocolU
u.append(":");
u.append(this.port);
}
if (isFile() && urlPath.indexOf('\\') >= 0) { // normalize windows backslash (important for hash computation)
urlPath = urlPath.replace('\\', '/');
}
u.append(urlPath);
String result = u.toString();

View File

@ -638,10 +638,13 @@ dc_rights
return v;
}
/**
* We find all links that are part of a reference inside a url
*
* @param links links is either a Set of AnchorURL, Strings (with urls) or htmlFilterImageEntries
* @return map with contained urls as key and "ref" as value
*/
private static Map<AnchorURL, String> allReflinks(final Collection<?> links) {
// links is either a Set of Strings (with urls) or
// htmlFilterImageEntries
// we find all links that are part of a reference inside a url
final Map<AnchorURL, String> v = new HashMap<AnchorURL, String>();
final Iterator<?> i = links.iterator();
Object o;
@ -663,7 +666,9 @@ dc_rights
continue loop;
}
u = url.toNormalform(true);
if ((pos = u.toLowerCase().indexOf("http://", 7)) > 0) {
// find start of a referenced http url
if ((pos = u.toLowerCase().indexOf("http://", 7)) > 0) { // 7 = skip the protocol part of the source url
i.remove();
u = u.substring(pos);
while ((pos = u.toLowerCase().indexOf("http://", 7)) > 0)
@ -673,16 +678,30 @@ dc_rights
v.put(url, "ref");
continue loop;
}
if ((pos = u.toLowerCase().indexOf("/www.", 7)) > 0) {
// find start of a referenced https url
if ((pos = u.toLowerCase().indexOf("https://", 7)) > 0) { // 7 = skip the protocol part of the source url
i.remove();
u = "http:/" + u.substring(pos);
while ((pos = u.toLowerCase().indexOf("/www.", 7)) > 0)
u = "http:/" + u.substring(pos);
u = u.substring(pos);
while ((pos = u.toLowerCase().indexOf("https://", 7)) > 0)
u = u.substring(pos);
url = new AnchorURL(u);
if (!(v.containsKey(url)))
v.put(url, "ref");
continue loop;
}
if ((pos = u.toLowerCase().indexOf("/www.", 11)) > 0) { // 11 = skip protocol part + www of source url "http://www."
i.remove();
u = url.getProtocol()+":/" + u.substring(pos);
while ((pos = u.toLowerCase().indexOf("/www.", 11)) > 0)
u = url.getProtocol()+":/" + u.substring(pos);
AnchorURL addurl = new AnchorURL(u);
if (!(v.containsKey(addurl)))
v.put(addurl, "ref");
continue loop;
}
} catch (final MalformedURLException e) {
}
return v;

View File

@ -2,6 +2,7 @@ package net.yacy.cora.document.id;
import java.net.MalformedURLException;
import junit.framework.TestCase;
import net.yacy.cora.document.encoding.ASCII;
import org.junit.Test;
public class DigestURLTest extends TestCase {
@ -30,4 +31,23 @@ public class DigestURLTest extends TestCase {
}
}
/**
* Test hash() of DigestURL and File protocol to deliver same hash for
* allowed Windows or Java notation of same file
*/
@Test
public void testHash_ForFile() throws MalformedURLException {
String winUrlStr = "file:///C:\\tmp\\test.html"; // allowed Windows notation
String javaUrlStr = "file:///C:/tmp/test.html"; // allowed Java notation for Windows file system
DigestURL winUrl = new DigestURL(winUrlStr);
DigestURL javaUrl = new DigestURL(javaUrlStr);
String winHashResult = ASCII.String(winUrl.hash());
String javaHashResult = ASCII.String(javaUrl.hash());
assertEquals("hash for same file url", javaHashResult, winHashResult);
}
}

View File

@ -127,6 +127,9 @@ public class MultiProtocolURLTest {
new String[]{"http://www.yacy.net?query=test", "www.yacy.net"},
new String[]{"http://www.yacy.net:?query=test", "www.yacy.net"},
new String[]{"//www.yacy.net:?query=test", "www.yacy.net"},
new String[]{"http://www.yacy.net?data=1/2/3", "www.yacy.net"},
new String[]{"http://www.yacy.net?url=http://test.com", "www.yacy.net"}
};
for (int i = 0; i < testStrings.length; i++) {